android - How can I make the spinner width same as largest available item width -


i realize use wrap_content spinner (i avoid using match_parent not want spinner overly long), , using match_parent spinner's item view , drop down item view,

i still find spinner's width not same largest item's width

enter image description here

as can see, unitedkingdom not fit.

so, if select unitedkingdom, spinner's resize

enter image description here

how can make spinner resize largest available item width, without being explicitly selecting largest item?

my spinner xml is

<spinner     android:id="@+id/spinner1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_marginbottom="10dp" />  

and spinner's views xml are

<textview xmlns:android="http://schemas.android.com/apk/res/android"      android:id="@+id/text_view_0"     style="?android:attr/spinneritemstyle"     android:singleline="true"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:drawablepadding="10dp"     android:gravity="center_vertical" /> 

<checkedtextview xmlns:android="http://schemas.android.com/apk/res/android"      android:id="@+id/checked_text_view_0"     style="?android:attr/spinnerdropdownitemstyle"     android:singleline="true"     android:layout_width="match_parent"     android:layout_height="48dp"     android:minheight="48dp"     android:drawablepadding="10dp" /> 

you should able effect want specifying width of dropdown wrap_content:

<spinner     android:id="@+id/spinner1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_marginbottom="10dp"     android:dropdownwidth="wrap_content"     android:spinnermode="dropdown" /> 

this measure 15 items in spinner's adapter determine width should use.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -