这是我的一个 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/