如何添加一个新行到Android的一个TextView? [英] How do I add a newline to a TextView in Android?

查看:160
本文介绍了如何添加一个新行到Android的一个TextView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

解决方案

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

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.

这篇关于如何添加一个新行到Android的一个TextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆