我有一个TextView填充了从数据库中获取的文本,所以其长度未定义。TextView多行
我已经使用maxline属性配置了TextView,并将其值设置为3,因为我不想要超过3行的文本,并且还使用了ellipsize属性。
但它无法正常工作。虽然文本大于3行,但它只打印两行。
<TextView
android:id="@+id/etLugar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tvLugar"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/tvLugar"
android:text="A very large text than must be shown in the textview, but no more of three lines are going to be shown"
android:textColor="@color/foreground1"
android:maxLines="3"
android:ellipsize="end"
android:textSize="12dp"
/>
我不明白maxlines属性为什么不能正常工作。我做错了什么?
感谢
用于字符串长度和子字符串来限制:) – iNan 2012-07-20 11:26:20
“android:text'属性中是否存在'\ n'?只有这是它认为的新线。 – RTB 2012-07-20 11:26:45