righthaa.blogg.se

Android studio spinner setdropdownviewresource
Android studio spinner setdropdownviewresource












You define a layout to 'look' like a prompt, for example, grayed out. The Dropdown doesn't normally show the prompt)

android studio spinner setdropdownviewresource

(Note: Some themes show a DropDown for a Spinner instead of a dialog. This allows you to use a standard prompt or define your own 'nothing selected' as the first row, or both, or none. (So you have to use the setTag or something else to ensure your convertView is correct.) Spinner does not support multiple view types There is an Android bug that makes this a little tougher to re-use views. (Swap cursor on the wrapped cursorAdapter of course.)

android studio spinner setdropdownviewresource

Here is a working example tested for Android 2.3, and 4.0 (it uses nothing in the compatibility library, so it should be fine for awhile) Since it's a decorator, it should be easy to retrofit existing code and it works fine with CursorLoaders also.

android studio spinner setdropdownviewresource

What you can do is decorate your SpinnerAdapter with one that presents a 'Select Option.' View initially for the Spinner to display with nothing selected.














Android studio spinner setdropdownviewresource