android - 创建多行 TextView

标签 android textview

我有一个 TextView,它应该有 4 行长。

First line text should be "YES"
Second Line ="No"
Third Line = "true"
Fourth line + "false"

如何使用单个 TextView 完成此操作?

最佳答案

尝试以下多行 TextView。

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:maxLines="4" 
    android:singleLine="false" 
    android:text="YES\nNo\ntrue\nfalse" />

您可以尝试 \n 在下一行设置文本。

关于android - 创建多行 TextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10815093/

相关文章:

android - 使 NumberPicker 字符串值可重复

android - 简单的 XML ElementListUnion - 不允许两个通用列表?

java - 将Amazon SimpleDB与Android结合使用

android - APK 50meg+ 扩展包和 Flash

java - Android - 如何在 TextView 中打印结果?

android - 为什么 AutoCompleteTextView 的名字这么奇怪?

android - 强制 textview 显示只有英文数字的数字

android - Facebook SDK 登录有效,但之后关闭应用程序

java - 移动 TextView 框使我的 Android 应用程序崩溃

android - android :drawableTop is added to xml file时应用程序崩溃