Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set spinner mode in XML

When defining a spinner in code, you can set the mode to 'dialog' or 'dropdown':

Spinner(Context context, int mode) Construct a new spinner with the given context's theme and the supplied mode of displaying choices.

But I can't find this option when defining my layout in XML. Did I just miss it, or is this not possible in XML?

like image 671
Bernard Avatar asked Nov 30 '22 16:11

Bernard


2 Answers

As of API level 11, you can use

<Spinner style="@android:style/Widget.Spinner.DropDown" ... />

or

<Spinner android:spinnerMode="dropdown" ... />
like image 102
Ted Hopp Avatar answered Dec 10 '22 11:12

Ted Hopp


No, according to the reference found here this is not possible. There is no corresponding XML attribute listed. Like other things as setting 24h mode for a timepicker, which is not possible in XML.

like image 39
Michael Rose Avatar answered Dec 10 '22 12:12

Michael Rose