4

I have a TextView that should be 4 lines long .

First line text should be "YES"
Second Line ="No"
Third Line = "true"
Fourth line + "false"

How can this be done with a single TextView?

p.campbell
  • 98,673
  • 67
  • 256
  • 322
Kumar
  • 169
  • 2
  • 5
  • 12

2 Answers2

18

try following for multiline TextView.

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:maxLines="4" 
    android:singleLine="false" 
    android:text="YES\nNo\ntrue\nfalse" />

You can try \n to set text in next line.

Ronak Mehta
  • 5,971
  • 5
  • 42
  • 69
2

Try this:

<TextView android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:lines="4"
    android:text="YES\nNo\ntrue\nfalse" />
Simon
  • 14,407
  • 8
  • 46
  • 61