title: Different views for spinner and spinner item?
body: <p>Is there any way I can set a different view for the closed spinner view and the spinner item view?  </p>
  
  <p>I assume that the resource id used in the <code>ArrayAdapter</code> would be used for the closed item view, as well as the item views, so I extended the <code>ArrayAdapter</code> and defined the <code>getView</code> which uses a different resource, but the resource id in the call to the super constructor doesn't seem to be used ever, only the resource id used in <code>getView</code> seems to be used</p>
  
  <p>In the <a href="http://codesearch.google.com/codesearch#uX1GffpyOZk/core/java/android/widget/SpinnerAdapter.java&amp;q=package%3aandroid.git.kernel.org%20file%3aandroid/widget/SpinnerAdapter.java&amp;l=1">Spinner.java code</a> it states:</p>
  
  <blockquote>
    <p>A spinner adapter allows to define two different views: one that shows the data in the spinner itself and one that shows the data in the drop down list when the spinner is pressed.</p>
  </blockquote>
  
  <p>but it doesn't seem possible given the code. </p>
  
  <p>Anyway - my code:</p>
  
  <pre><code>public class CustomArrayAdapter &lt;T&gt; extends ArrayAdapter&lt;T&gt; {
  
      int itemViewResourceId;
      private LayoutInflater inflater;
      ViewPopulator&lt;T&gt; viewPopulator;
      private List&lt;T&gt; objects;
  
      public CustomArrayAdapter(Context context, int textViewResourceId, int itemViewResourceId, ViewPopulator&lt;T&gt; viewPopulator, List&lt;T&gt; objects) {
          super(context, textViewResourceId, objects);
          inflater = LayoutInflater.from(context);
          this.viewPopulator = viewPopulator;
          this.itemViewResourceId = itemViewResourceId;
          this.objects = objects;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          if(convertView == null || convertView.getTag() == null) {
              // new view - populate 
              convertView = inflater.inflate(itemViewResourceId, parent, false);
              convertView.setTag(new Object());
          }
          viewPopulator.populateView(position, convertView, parent, objects.get(position));
          return convertView;
      }
  }
  
  public abstract class ViewPopulator&lt;T&gt; {
      public abstract void populateView(int position, View convertView, ViewGroup parent, T item);
  }
  </code></pre>
  
  <p>called with:   </p>
  
  <pre><code>CustomArrayAdapter&lt;T&gt; typeAdapter = new CustomArrayAdapter&lt;T&gt;(context, R.layout.list_item, R.layout.list_item_big, new ViewPopulator&lt;T&gt;() {
          @Override
          public void populateView(int position, View convertView, ViewGroup parent, T item) {
              ((TextView) convertView.findViewById(R.id.list_item)).setText(position + " - " + item.getName());
          }
      }, itemsByType.get(type));
  </code></pre>
  
  <p>** EDIT **</p>
  
  <p>The resource id used is the <code>itemViewResourceId</code> defined in the <code>getView</code> method - 
  adding a new method to <code>CustomArrayAdapter</code>, overriding <code>getDropDownView</code> as below give me the same results of the <code>itemViewResourceId</code> being used for all the styling, and the <code>textViewResourceId</code> not being used at all.  However, removing the <code>getView</code> results in the <code>textViewResourceId</code> being used - hence I don't think that <code>getDropDownView</code> actually does anything:</p>
  
  <pre><code>    @Override
      public View getDropDownView(int position, View convertView, ViewGroup parent) {
          if(convertView == null || convertView.getTag() == null) {
              // new view - populate 
              convertView = inflater.inflate(itemViewResourceId, parent, false);
              convertView.setTag(new Object());
          }
          viewPopulator.populateView(position, convertView, parent, objects.get(position));
          return convertView;
      }
  </code></pre>