当我定义一个TextView在xml,我如何添加一个新的行?\n似乎不起作用。
<TextView
android:id="@+id/txtTitlevalue"
android:text="Line1 -\nLine2"
android:layout_width="54dip"
android:layout_height="fill_parent"
android:textSize="11px" />
当我定义一个TextView在xml,我如何添加一个新的行?\n似乎不起作用。
<TextView
android:id="@+id/txtTitlevalue"
android:text="Line1 -\nLine2"
android:layout_width="54dip"
android:layout_height="fill_parent"
android:textSize="11px" />
当前回答
试试这个:
android:text="Lorem Ipsum \nDolor Ait Amet \nLorem Ipsum"
其他回答
试一试:
android:行= " 2 "
\n应该工作。
android:text="Previous Line Next Line"
这是可行的。
试试这个:
android:text="Lorem Ipsum \nDolor Ait Amet \nLorem Ipsum"
需要保留
1.android:maxLines="no of lines"
2.并使用\n获取下一行
尝试System.getProperty(“line.separator”);