Skip to content Skip to sidebar Skip to footer

Spinner Width Does Not Matches With Spinner Item Width

When I use specific width like 400dp for the DropDown item's width and spinner width it matches properly. But When I am using match_parent for the spinner and custom_spinner_item w

Solution 1:

The best way will be hiding down arrow of Spinner by giving

android:background="@null"

to Spinner

So that item will take whole space of Spinner

Then put down arrow in a ImageView and align to right of Spinner

<RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"><Spinnerandroid:id="@+id/spinner1"android:layout_width="match_parent"android:background="@null"android:layout_height="35dp"android:dropDownWidth="match_parent"android:spinnerMode="dropdown" /><ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignEnd="@+id/spinner1"android:layout_alignRight="@+id/spinner1"android:src="@drawable/arrow_down"android:layout_alignTop="@id/spinner1"android:layout_alignBottom="@+id/spinner1"/></RelativeLayout>

Post a Comment for "Spinner Width Does Not Matches With Spinner Item Width"