title: Dynamically change width of spinner in Android
body: <p>I tried to dynamically change the width of a spinner with the code below, but I get an error message. What is the correct way to do this?</p>
  
  <pre><code>Spinner s1 = (Spinner) findViewById(R.id.s1_10);
  s1.setLayoutParams(new LayoutParams(400, LayoutParams.WRAP_CONTENT));
  </code></pre>