Spinner item not showing as dropdown but in the to

2019-08-03 10:39发布

问题:

i am using spinner in my code which i had declare in my xml

xml code for spinner:-

<Spinner
        android:id="@+id/spinner"
        android:layout_width="180dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button1"
        android:layout_marginTop="133dp"
        android:drawSelectorOnTop="true" />

so as can be seen that the spinner is down the one button which is also in that layout xml .Now when i run my app its loading all data correctly but the item is showing in the top of the spinner not in the down side of the spinner.Mentioning the screenshot how it appear

but when i m using the same spinner parallel to the button the spinner dropdown effect working very fine.Here is the screenshot how it appear.

so can any tell me how can we solve this kind of scenario.thanks for any reply.

回答1:

try this hope this will help you

 android:spinnerMode="dropdown"