title: Manually set width of spinner dropdown list in android
body: <p>Is it possible to set the width of a spinner dropdown list in code? I have a spinner populated with integers, and it does not look good with the list expanding to full width. Can I set the width to wrap the content somehow?</p>
  
  <pre><code>Spinner hSpinner = (Spinner) timerView.findViewById(R.id.timer_hour_spinner);
  ArrayList&lt;Integer&gt; hList = new ArrayList&lt;Integer&gt;(21);
  
  for (int i = 0; i &lt;= 20; i++) { hList.add(i); }
  
  ArrayAdapter hAdapter = new ArrayAdapter(RemindMe.this, android.R.layout.simple_spinner_item, hList);
  hAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
  hSpinner.setAdapter(hAdapter);
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>Linus</p>