32

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,491
  • 9
  • 32
  • 41
UMAR-MOBITSOLUTIONS
  • 77,236
  • 95
  • 209
  • 278

4 Answers4

39

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

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
18

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
  • 10,447
  • 2
  • 46
  • 52
12

You could also try

android:inputType="textMultiLine"

in your XML. This worked for me.

remykarem
  • 2,251
  • 22
  • 28
4

You need to set

 android:minLines="2"
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Aliya
  • 1,168
  • 12
  • 17