">
赞
踩
如果只是在xml里的话,在文字中间加上 \n 就可以了
示例;
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hello \n blank fragment" />
string.xml文字换行及其它效果
为了方便统一管理,国际化等,我们通常把字符串保存在string.xml中,但这些字符串中直接输入一些符号不起任何作用,比如基本的换行、缩进、空格,这就要用转义字符来进行转义,这样才能给字符串添加样式。
常用的XML转义字符如下
<string name="app_names">在上海6.30号\n建军节前一天,准备晚上去看灯光秀。</string>
<string name="app_title">在上海6.30号\t建军节前一天,准备晚上去看灯光秀。</string>
<string name="app_setting">        在上海6.30号, 准备晚上去看灯光秀。</string>
<string name="app_others">3<4 小于号</string>
<string name="app_others1">99>98 大于号</string>
<string name="app_others2">A&B 和</string>
<string name="app_others3">'B' 单引号</string>
<string name="app_others4">"B" 双引号</string>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。