android - Custom spinner items not appearing as part of Spinner -
i'm running problem: when use non-trivial type of spinner item, spinner displays drop-down list someplace other on spinner.
(note: of description identical https://stackoverflow.com/questions/4188443/android-doesnt-honor-selection-change-with-custom-spinner-items, problem i'm reporting here different. i've split these it's clear direct different replies to)
my goal have more fancy display each item in spinner, , started creating layout contains several items, 1 of target textview (lbl2, in case)
i attempt set spinner (my eventual goal populate spinner programmatically, i'm not using resources set up) using:
spinner spinner = (spinner) findviewbyid(r.id.spinner); arrayadapter<charsequence> adapter = new arrayadapter<charsequence>( this, r.layout.spinner_fancy, r.id.lbl2); adapter.add("item #1"); adapter.add("item #2"); adapter.add("item #3"); spinner.setadapter(adapter);
when run program looks (mostly) - spinner is, in fact, rendering goofy-looking multi-color, vertical layout of 3 textviews each item, , it's correctly substituting item #1, item #2, , item #3 lbl2. can click on spinner & bring drop-down list of choices.
this problem items aren't displayed on spinner. instead they're kind of floating on activity, bit further down. picture clarify: floating spinner elements http://www.freeimagehosting.net/uploads/bf9f584156.png
edit: vote - i've fixed image it's inline!
android spinners work in way... list of items shown in "dialog mode".
you can add title list using in xml layout (in spinner section):
android:prompt="select fancy item..."
Comments
Post a Comment