When I define a TextView
in xml
, how do I add a new line to it? \n
seems not to work.
<TextView
android:id="@+id/txtTitlevalue"
android:text="Line1: \n-Line2\n-Line3"
android:layout_width="54dip"
android:layout_height="fill_parent"
android:textSize="11px" />
Make sure your
\n
is in"\n"
for it to work.For me the solution was to add the following line to the layout:
And \n shows up as a new line in the visual editor. Hope it helps!