如何添加一个新行到Android的一个TextView?新行到、Android、TextView

2023-09-12 00:47:58 作者:月と殇

当我在XML一个TextView定义,如何添加新行了吗? \ñ接缝到不行。

 <的TextView
   机器人:ID =@ + ID / txtTitlevalue
   机器人:文本=1号线:\正线2 \正行3
   机器人:layout_width =54dip
   机器人:layout_height =FILL_PARENT
   机器人:TEXTSIZE =11像素/>
 

解决方案

不信任的可视化编辑器。 您的code确实在动车组的工作。

Android的ListView,内部每一行都是一个item,每个item包含俩textview和一个imageButton

When I define in a TextView in XML, how do I add new line to it? \n seams to not 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" />

解决方案

Don't trust the Visual editor. Your code does work in the emu.