Im My application I want the below type of Spinner Dropdown view . For this type of spinner view. I wrote this code.
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.spinner, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner_obj.setAdapter(adapter);
I got this from http://developer.android.com/guide/topics/ui/controls/spinner.html But what I got is,
Please provide me the best way to do this....
may be you are running in below than 4.0 , 4.0 will show you dropdown as your image
You can use popup like below:
Your application is running on old theme.
If you are using android 4.2 set android application theme (in the manifest file) to
OR
Its a
AutocompleteTextView
widget that you are suppose to use but you have tried withSpinner
widget.If my guess is right, Please refer the link. AutocompleteTextView
Cheers.
Kind of reviving an old post here but the accepted answer is far from ideal. The correct way to do this is to set the Spinner to dropdown mode in your layout xml:
The available options are "dialog" and "dropdown".
For the GUI Use HoloEverywhere. https://github.com/Prototik/HoloEverywhere HoloEverywhere is the best way to go if you want Holo theme on older Android then 4.0 .
And for the dropdown use android:spinnerMode="dropdown" in the layout as Stephen Kidson mentioned.