shay mishali shay mishali - 2 months ago 14
Android Question

Spinner opens from top and not from bottom

[You can perfectly see the problem here, the drop downlist opens from the top of the spinner and not from the bottom and I don't know what to do, couldn't find any solution on google either, please help me] sorry for external image link, for some reason it wont load the picture here..

enter image description here

here is my spinner code:

<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/rgGender"
android:entries="@array/months_array"
android:textAlignment="center"
android:id="@+id/spMonth"
style="@style/Base.Widget.AppCompat.Spinner.Underlined"/>

Answer

This would happen if the item which inflates the spinner is close to the bottom of the screen.

Since the spinner would not have enough room (or just barely enough room) if inflated downward, it is inflated upward instead. Try putting the spinner higher (vertically) in the layout.

It depends on Screen size, If you test it on other device it will show at down/up.

I suggest you to test it on different devices.

you can use custome adapter if you want

<Spinner
...
android:overlapAnchor="false" />

Please check this answer and this answer