Android - Spinner: text in several lines

1.8k Views Asked by At

I have done the tutorial about Spinner ([http://developer.android.com/resources/tutorials/views/hello-spinner.html]). However, if the text is much longer than the names of the planets, after clicking the spinner the displayed text is truncated, it is not displayed in its entirety.

Do anyone happen to know how to make the longer text to be displayed in several lines?

After clicking the spinner texts are shown in the table of obejcts called CheckedTextViews. Maybe some preferences of those should be modificated - it is just the quick idea.

Will be glad for any support.

1

There are 1 best solutions below

0
On

This also works well.

<LinearLayout 
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="350dp"
 android:layout_height="wrap_content">

<TextView 
 android:id="@android:id/text1"
 style="?android:attr/spinnerDropDownItemStyle"
 android:layout_width="match_parent"
 android:layout_height="50dp"
 android:ellipsize="marquee"
 android:gravity="center_vertical"
 android:singleLine="false" />
</LinearLayout>