31

I am using following TextView to display some data in it:

<TextView android:id="@+id/notificationText" 
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:textSize="18sp"
        android:inputType="textMultiLine"
        android:maxLines="2"
        android:layout_paddingRight="20dip"
        android:textColor="#ffffff"/>

I want to wrap text to next line. How can I do this?

Bugs
  • 4,356
  • 9
  • 30
  • 39
UMAR-MOBITSOLUTIONS
  • 73,009
  • 94
  • 197
  • 273

4 Answers4

39

you must set android:scrollHorizontally="false" in your xml.

Paresh Mayani
  • 122,920
  • 69
  • 234
  • 290
15

In Some case It works by setting width to 0dp on text views.

android:layout_width="0dp"

here is a link to original answer.

Community
  • 1
  • 1
vikas kumar
  • 7,846
  • 1
  • 33
  • 39
11

You could also try

android:inputType="textMultiLine"

in your XML. This worked for me.

remykarem
  • 1,467
  • 18
  • 22
4

You need to set

 android:minLines="2"
IntelliJ Amiya
  • 70,230
  • 14
  • 154
  • 181
Aliya
  • 1,118
  • 11
  • 16