I am trying to create Spinners that look the same in all versions of Android back to Froyo. For this purpose I use HoloEverywhere . Some of the text of a spinner element is more than one line, and I would like it to turn around.
Using the default layout, android.R.layout.simple_spinner_dropdown_item or a replacement replacement for HoloEverywhere , ellipses the text rather than wraps it.
Taking the HoloEverywhere template as the starting point for a custom layout with singleLine set to false , ellipsize set to none , and layout_height set to wrap_content does not help, the text is still disabled.
I can get the text for proper packaging in the drop-down list by wrapping the TextView in LinearLayout , but on Froyo devices this will ruin the display of the selected item: 
This method works great on new devices. Drop-down item layouts are great for all devices. But Froyo makes this weird text overlap when I use a custom drop-down layout. Each selection simply stacks on top of the last.
This question: Spinner does not wrap text - is this an Android bug? about wrapping text in Spinners suggests that the only way to do this is to recreate the style from scratch without inheritance, but it sounds crazy and prone to problems.
my_simple_list_item_1.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="300dp" android:layout_height="wrap_content" > <TextView android:id="@+id/android:text1" android:layout_width="wrap_content" android:layout_height="50dp" android:ellipsize="marquee" android:layout_gravity="center_vertical" android:singleLine="false"/> </LinearLayout>
Java:
import org.holoeverywhere.widget.Spinner; spinner1.setAdapter(ArrayAdapter.createFromResource(this, R.array.array_of_strings, R.layout.my_simple_list_item_1));
android android-layout styles android-spinner android-holo-everywhere
Michael alan huff
source share