Code example for SpinnerAdapter

Methods: getDropDownView

0
    // BUG! Vote to fix!! http://code.google.com/p/android/issues/detail?id=17128 - Spinner does not support multiple view types 
    if (position == 0) {
        return nothingSelectedDropdownLayout == -1 ? new View(context) : getNothingSelectedDropdownView(parent);
    } 
 
    return adapter.getDropDownView(position - EXTRA, null, parent);  // could re-use the convertView if possible, utilize setTag...
} 
 
/** 
 * Override this to do something dynamic... e.g. "Pick your Favorite of these 37"   
 * @param parent 
 * @return 
 */ 
protected View getNothingSelectedDropdownView(ViewGroup parent) {
    return layoutInflater.inflate(nothingSelectedDropdownLayout, parent, false);
} 
 
@Override 
public int getCount() { 
    int count = adapter.getCount();
    return count == 0 ? 0 : count + EXTRA;