Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spinner dropdown height to match parent

Is it possible to adjust height of Spinner dropdown to fill the entire screen. Right now i have 3 items that i dynamically add into the spinner adapter but these only cover half of the screen. What i have right now is something like this:

enter image description here

What i want is something like this:

enter image description here

I could add empty items but that won't solve the problem for different screen sizes

I tried to implement a style on the spinner but it didn't work

<style name="MyCustomSpinner" parent="Widget.AppCompat.Spinner.DropDown">
    <item name="android:dropDownHeight">match_parent</item>
</style>

UPDATE

I have a view between action bar and spinner so i cannot use layout_weight=1 for my spinner

like image 605
stud91 Avatar asked Nov 16 '15 06:11

stud91


2 Answers

try using this with your adapter.

adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
like image 72
Syed Arsalan Kazmi Avatar answered Nov 10 '22 13:11

Syed Arsalan Kazmi


The only way to achieve this is by writing your own view that works like a spinner.

like image 26
EmptyCup Avatar answered Nov 10 '22 12:11

EmptyCup