title: How to change layout of spinner in Android
body: <p><img src="https://i.stack.imgur.com/mxgGO.png" alt=""></p>
  
  <p>When O click on this spinner it gives a big dropdown:</p>
  
  <p><img src="https://i.stack.imgur.com/JbaBF.png" alt="enter image description here"></p>
  
  <p>I want a very small view as in the second image. Just like dropdowns in ASP.NET. Like this with width little more reduced.</p>
  
  <p><img src="https://i.stack.imgur.com/Lj9Ib.png" alt="enter image description here"></p>
  
  <p>I used the following code. Any help to change the view of second image will be appreciated.</p>
  
  <pre><code>Spinner spinner = (Spinner) findViewById(R.id.spinner);
  ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(
         this, R.array.planets_array, android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  </code></pre>