如何在 Android 中的 TextView 中添加换行符? [英] How do I add a newline to a TextView in Android?

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

问题描述

当我在 xml 中定义一个 TextView 时,如何在其中添加新行? 似乎不起作用.

When I define a TextView in xml, how do I add a new line to it? seems not to work.

<TextView
   android:id="@+id/txtTitlevalue"
   android:text="Line1 -
Line2"
   android:layout_width="54dip"
   android:layout_height="fill_parent"
   android:textSize="11px" />

推荐答案

试试:

android:lines="2"

应该可以工作.

should work.

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

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