Development issue/problem:

If the text of a filiform element is too long to fit on a single line, the text is shortened instead of wrapped. This is only the case with an API level >= 11. Here are screenshots of Android 4.2.2 (left) showing the bad behavior, and Android 2.3.3 (right) where it seems as expected.

android:singleLine=false is just being ignored here. Like all other attempts such as android:lines, android:minLines, etc. it is not possible to use the same software. For some reason, TextView seems to be much wider than the width of the window.

I saw that other people had the same problem, but no one could find a solution. So it’s a system malfunction? I don’t think this discrepancy between the OS versions can be deliberate.

Some questions were relatively easy to answer.

UPDATE: I also uploaded this project to GitHub as an example: Download

/res/values/array.xml :

Lorem ipsum dolor sit amet, consetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.
In vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est.

/res/lay-out/spinner_item.xml :

Install the adapter :

R.layout.spinner_item)) ;

How can I solve this problem?

Solution 1:

The Holo-theme rotation mode is the drop-down mode by default. And all moves with the standard style override simply switch to spinner mode in dialogue mode, so you can successfully wrap multi-line text like in api 11. Instead, you can create a spinner using the new spinner(context, Spinner.MODE_DIALOG) or in xml: android:spinnerMode=dialog. But that doesn’t solve the problem because it’s a dialog, not a drop-down list.

I’ve found another solution to this problem: Replace the getDropDownView method in the ArrayAdapter and putSingleLine(false) in the Display Post method. In this way, the completely created text is included in the correct lines when you display it.

public view getDropDownView(final int position, View convertView, ViewGroup older) {
if (convertView == null) {
convertView = new TextView(_context);

TextView element = (TextView) convertView;
finalItem = article; Runnable() {
public void run() {
thing back;


And here’s another answer.

Manually wrap the list view in a PopupWindow and display it in TextView with a single click and hide it in a listItem.

A simple execution, just to show the idea:

The public MySpinner class extends TextView {
private PopupWindow _p;
private ListView _lv;
public MySpinner(Context context) {
public MySpinner(Context context, attributeSet attributeSet){
super(context, attributeSet);

private void init(){
final list list = new ArrayList();
list.add(Very long text AAAAAAAAAAAAAAAAAAA);
list.add(2 Very long text A);

setMinimumWidth(100) ;
setMaxWidth(200) ;

_lv = new ListView(getContext());
_lv.setAdapter(new ArrayAdapter(getContext(), R.layout.simple_list_item_1, list)));
_lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public null and void atItemClick(AdapterView adapterView, View view, int i, long l) {
}) ;

setOnClickListener(new OnClickListener() {
public void onClick(View view)) {

_p = new PopupWindow(getContext());

Solution 2:

Only the combination of solutions worked here for me (also tested on Android 5.1) :



final ArrayAdapter spinnerAdapter=new ArrayAdapter(activity,R.layout.spinner_item,,spinnerItemsList)
public view getDropDownView(final int position,final View convertView,final ViewGroup parent)
final View v=super.getDropDownView(position,convertView,parent); Runnable()
public void run()
return v;
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) ;

Solution 3:

I solved this problem by switching to a rotating dialogue style:

Solution 4:

It’s impossible to get multi-line dropdowns on spinners using the holothema from what I’ve tried.

A workaround is a workaround:

  • to create a style for spinners that wasn’t inherited from Holo. This makes it possible to create drop-down lists on different lines.
  • Draw the spinning top by hand to look like a holotem.

This creates (shows closed and open state) :

Spinner does not wrap text — is this an Android bug? –

Implementation details :

Taking over the holothema on the spinner and displaying multiple lines in the scrolling element of the spinner is, as far as I can see, not possible, although we do fake the TextView singleline attribute in the scrolling element and provide a custom layout. I’ve also tried to keep the holo-style, but I’ve changed…

android: spinnerStyle
android: spinnerItemStyle
android: spinnerDropDownItemStyle

Assign styles (example of use here), but I wasn’t able to get multi-line results.

However, if we ignore the style for spinning and do not inherit the SpinnerStyle from Holo :

then the scrolling element allows multiple lines to be displayed. But now we have lost the holothema in favor of rotation, and the closed state looks like a TextView instead of a rotation, without arrows or visual indications that it is a rotation. If you set the spinnerStyle parent instead to: parent=android:style/Widget.Spinner :

The closed state of the router shows an arrow, but looks like a gray PreHolo router that does not seem to fit in the Holo application.

So, a possible solution:

  • Cancel the theme for spinnerStyle and do not use the holo for parents. This allows you to display multiple texts in the drop-down elements.
  • Change the background of the router to make it appear as if it has inherited the holothema.

Here’s an example:

Creating a core business :

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState) ;
setContentView(R.layout.activity_main) ;

Spinner spinner = (spinner)findViewById( ;


Structure of activities :


Place spinner_background_holo_light in the render folder :

and paste these drawings into your drawing board PDF folder:

Spinner does not wrap text — is this an Android bug? –

Spinner does not wrap text — is this an Android bug? –

Spinner does not wrap text — is this an Android bug? –

Spinner does not wrap text — is this an Android bug? –

The result is a spinner with a closed holothema and multi-line elements, as can be seen in the screenshots above.

The drop-down lists in this example are not holistic, but this can be an acceptable compromise if the multiple display of drop-down lists is really important.

In this example, the android:minSdkVersion in the manifest is set to 14 and the android:targetSdkVersion is set to 17.

Holo graphics and spinner_background_holo_light.xml code are from HoloEverwhere Copyright (c) 2012 Christophe Versieux, Sergey Shatunov. See the section on the Github project for license information.

Solution No 5:

By adding a LinearLayout around a TextView, you can wrap the text correctly.

Layout (common_domainreferencemodel_spinner_item.xml) :

Adaptors :

The public class DomainReferenceModelAdapter extends the ArrayAdapter {

private List objects;
private LayoutInflater inflater;
private int oddRowColor = Color.parseColor(#E7E3D1);
private int evenRowColor = Color.parseColor(#F8F6E9) ;

public DomainReferenceModelAdapter(Context, int resource, List of objects) {
super(context, resource, objects);
this.objects = objects;
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

ImageStatic class holder {
public TextView nameTextView;

public view getView(int position, View convertView, ViewGroup parent) {
return getViewInternal(position, convertView, parent, false);

public view getDropDownView(int position, View convertView, ViewGroup parent) {
return getViewInternal(position, convertView, parent, true);

private View getViewInternal(int position, View convertView, ViewGroup parent, boolean isDropdownView) {
view = convertView;
if (view == null) {
view = inflater.inflate(R.layout.common_domainreferencemodel_spinner_item, null);
viewHolder viewHolder = new ViewHolder();
viewHolder.nameTextView = (TextView) view.findViewById(;
if (isDropdownView) {
view.setBackgroundColor(position % 2 == 0 ? evenRowColor: oddRowColor);
viewHolder = (viewHolder) view.getTag();
DomainReferenceModel = objects.get(position);
return view;


Solution No 6:

I had the same problem. I want to see 2 lines in the spinner’s drop-down menu, but all the solutions I found seem to be insufficient to solve such a simple problem. I looked at the source code of the Spinner and found that if we use a custom .xml with the attribute android:singleLine=false.

and ArrayAdapter, the following code is executed by default in the ListPopupWindow each time

View More getView(int position, boolean[] isScrap) {
View View = super.getView(int position, isScrap) ;

if (Image of TextView instance) {
((Image of TextView)).setHorizontallyScrolling(true);

Rear view;

and so we only see one line at a time on the list, it actually rolls.

To solve such a problem, our view doesn’t have to be a TextView example, you simply place your TextView in a FrameLayout or LinearLayout.


ArrayAdapter = new ArrayAdapter (this,
awasomeListValues) ;

This solution works in both turning modes: MODE_DROPDOWN and MODE_DROPDOWN.hope this helps you!

Solution No 7:

I think there’s a bug on Android. You can try that. Delete spaces from the text and then display them on the screen. If the representation length of the text is < string length, all characters after the space are ignored.
You can try this as a cure:

Add a file named multiline_spinner_dropdown_item.xml with sample code to the res/lay-out folder :

and when you make a dice, you make it from this layout.

Kind of like:

ArrayAdapter.createFromResource(this, items, R.layout.multiline_spinner_dropdown_item) ;

Basically, copy the android.R.layout.simple_spinner_dropdown_item layout into the project and change the layout by setting the singleLine attribute in CheckedTextView to false.

Solution No 8:

I did it to make it work:

ArrayAdapter Adapter = new ArrayAdapter(getContext(), R.layout.simple_dropdown_item_multiline,, choice) ;

And this is the content of simple_dropdown_item_multiline :

Solution No 9:

I just found out that Android has an existing style for this.

final Spinner pelanggaran = (Spinner) findViewById(;
ArrayAdapter pelanggaran_adapter = ArrayAdapter.createFromResource(this,R.array.pelanggaran_array,android.R.)layout.simple_expandable_list_item_1) ;
pelanggaran_adapter.setDropDownViewResource(android.R.layout.simple_expandable_list_item_1) ;
pelanggaran.setAdapter(pelanggaran_adapter) ;

I hope this solves your problem.

Solution No 10:

ArrayAdapter specAdapter =
android.R.layout.select_dialog_item) ;
specAdapter.setDropDownViewResource(android.R.layout.select_dialog_item) ;

Good luck!

autocompletetextview,multiautocompletetextview,android autocompletetextview custom adapter,android autocompletetextview dropdown style,autocompletetextview onitemselectedlistener,autocompletetextview with listview in android,android spinner selected item text color,android spinner text color is white,android-spinner background color,change spinner arrow color android,android spinner style,textinputlayout hint always on top,custom textinputlayout android github,customize textinputlayout android,text input layout validation android,how to import textinputlayout android,textinputlayout gradle,android-spinner multiline text,android-spinner wrap text

You May Also Like

How to manage permissions on Android 11

Each new iteration of the Android operating system brings with it more…

Top Ranked Cell Phone Spy & Monitoring App For Parents

There are many ways to choose the application that is the best…

13 Best Puzzle Games For Android To Play On Your Smartphone

Sherlock Holmes. Byomkesh Bakshi. Pradosh Mitter. Hercules Poirot. Miss Marple. Do the…

How to Install and Use No-IP on Raspberry Pi? (Dynamic DNS) –

Whether you want to host a server on your Raspberry Pi (and…