How to wrap text in textview in Android

Sameer picture Sameer · Jan 31, 2011 · Viewed 170.8k times · Source

Does any one know how to wrap text in TextView in Android platform. i.e if the text in textview exceed the screen length it should be displayed in the second line.

I have searched and tried the following:

android:scrollHorizontally="false",
android:inputType="textMultiLine",
android:singleLine="false"

But none work..

Can anyone suggest how can I do it.

Answer

Guykun picture Guykun · Jun 27, 2012

For me this issue only occurred on Android < 4.0

The combination of parameters I used were:

android:layout_weight="1"
android:ellipsize="none"
android:maxLines="100"
android:scrollHorizontally="false"

The maxLines count seemed to be the random final piece that made my TextView wrap.