How to place the spinner under the spinner’s layout when it is clicked, and show the figure in candy and above?

Like the overflow menu, it overlaps the toolbar in the same way as the spinner closes itself when a drop-down item is displayed in candy and higher versions for Android. Therefore, I need to place it below the skewer, and not above it.

+6
source share
4 answers

you can use

android:overlapAnchor="false" 

This will show a drop-down list under the spinner image (work on api level 21 and above).

+17
source

For all api use

  android:dropDownVerticalOffset="35dp" 

or any other value appropriate to your needs.

+11
source

android:spinnerMode="dropdown" android:dropDownVerticalOffset="50dp"

This will display a drop down menu below the counter view.

0
source

Ues has the following attribute in Spinner

 android:dropDownVerticalOffset="35dp" 

Below is the code for Spinner

  <RelativeLayout android:layout_width="200dp" android:layout_height="wrap_content" android:layout_marginLeft="45dp" android:layout_marginRight="3dp" android:layout_weight=".28" android:orientation="horizontal"> <Spinner android:id="@+id/spinner_users" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_gravity="left" android:layout_marginLeft="5dp" android:background="@android:color/transparent" android:dropDownVerticalOffset="35dp" android:spinnerMode="dropdown" /> <ImageView android:layout_width="30dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_gravity="center" android:src="@drawable/drop_down" /> </RelativeLayout> 
0
source

All Articles