0

Whatever layout I use for my spinner's

setDropDownViewResource()

it always cuts off the text at the right edge.

android:singleLine(false)

doesn't seem to work in the dropdown of Holo spinner's. When I initiate the spinner with old dialog mode

Spinner spinner = new Spinner(this, SPINNER.DIALOG_MODE);

then the text wrapping works fine.

Why does the text not wrap in the Holo spinner dropdown?

Spinner spinner = new Spinner(this, SPINNER.MODE_DROPDOWN);

1 Answers1

0

In holo theme spinner by default uses dropdown mode. And all moves with overriding default styles just move to switching spinner mode to dialog mode which succesfully wraps multiline text as in api 11.

Solutions can be:

1) You can manually wrap listview in PopupWindow and show it under TextView on click and hide it on listItem click.

2) Override getDropDownView method in ArrayAdapter and put setSingleLine(false) in post method of view. So when view completly created it wraps the text to appropriate lines.

Here is the explanation in spinner-does-not-wrap-text-is-this-an-android-bug.

Community
  • 1
  • 1
sjain
  • 23,126
  • 28
  • 107
  • 185