how do i define the spinner items size when display for select? I have 100 items in spinner,when use the spinner, the items will full screen height. Can I display 10 items for every time?
Asked
Active
Viewed 443 times
0
-
i found i need answer, http://stackoverflow.com/questions/20597584/how-to-limit-the-height-of-spinner-drop-down-view-in-android – Alice May 10 '15 at 11:04
1 Answers
0
When You attach Your ArrayAdapter You have a chance to select two kind of layouts.
ArrayAdapter<YourClass> adapter = new ArrayAdapter<YourClass>(this, R.layout.spinner, objects);
adapter.setDropDownViewResource(R.layout.spinner_item_drop_down);
spinner.setAdapter(adapter);
Please note that:
a) R.layout.spinner - is layout of spinner in normal state
b) R.layout.spinner_item_drop_down - is layout of item on dropdown list.
You can assign sizes of elements in this b) layout xml.

madoxdev
- 3,770
- 1
- 24
- 39
-
each item layout has it's container. It can be LinearLayout or anything else. Sizes are given as with any other layout ressourcess in android. It can be given by dp units in property android:layout_height. – madoxdev May 10 '15 at 12:05