Image+TextView+radiobutton in spinner
First, I want to imitate the effect like "android.R.layout.simple_spinner_dropdown_item"
which is TextView+radiobutton
but either the getView() or getDropDownView only cares about one row at a time, while the whole radiobuttons in spinner is like one RadioGroup, and when dropdown view is opened, the radiobutton with which item is selected before must be checked.
so how can I imitate the layout like simple_spinner_dropdown_item?
Second, I want to add different ImageView in each row, so I can't just use the default simple_spinner_dropdown_item, I must redefine the ArrayAdapter.
So, is there a best way to get through these?
I like the layout in simple_spinner_dropdown_item, but I also want to add ImageView...
Please give me any cl开发者_JAVA技巧ue at all
Thanks!!
extend the adapter. Override getView() and change the view that is returned to what you are after.
Cheers,
if you want to implement a more generic adapter without overriding the arrayadapter you can look at the post at http://blog.app-solut.com/2011/03/using-custom-layouts-for-spinner-or-listview-entries-in-android/ its using the baseadapter which can be modified as desired.
精彩评论