android - textview 不支持多行

标签 android textview android-2.3-gingerbread

这是我的一个 TextView 的 XML 布局示例,它在 android 4.2 中正确显示自己......我已经将 Nexus S 降级到 gingerbread 2.3.6 以测试我的应用程序并调试它!现在,我的每个 TextView 占用的空间都不会超过一行,甚至不会在第一行的末尾换行。 (在 4.2 上,下面的示例采用 3 行,如果缺少某些文本,则在末尾添加“...”!)

如何使我的 textView 与 Gingerbread 兼容?谢谢!

<TextView
            android:id="@+id/TV_guideRow_subtitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/TV_guideRow_title"
            android:layout_below="@+id/TV_guideRow_title"
            android:text="blabla text that could go up to 3 lines"
            android:textColor="#3BB9FF"
            android:layout_alignParentRight="true"
            android:layout_above="@+id/TV_guideRow_more"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="3dp"
            android:ellipsize="end"
            android:maxLines="3"/>

最佳答案

你想要:

android:inputType="text|textMultiLine"

此外,根据该 TextView 的父级,多行可能无法正确呈现。尝试手动将高度设置为 100dp,看看是否可行。

关于android - textview 不支持多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18002885/

相关文章:

android - 如何在 Android 中显示基于经纬度和地点的 Google map ?

java - 如何为 Room 数据库的 @Entity 的字段编写循环

Android 数组结果显示在多个 TextView 中

android - 我需要自定义字体和 TextView 方面的帮助

html - 复选框出现 gary 并在 Galaxy Built in 浏览器和 Maxthon 中选中

android - 尝试在 Android 2.3.5 和 2.3.6 上打开排行榜时,Google Play 服务 6.1.11 (....-012) 崩溃

android - 以编程方式更改 R.String 的值

android - Kotlin 中 Dagger 2 的未解决引用

java - 在 array-android 应用程序中传递数组列表

java - 如何在Android中将2个TextView与if else条件放在同一位置