Android上的TextView只在横向或纵向方向上显示两行文字。

7

如果文本长度超过TextView的宽度,在第二行后,会将其截断并在末尾添加“...”。无论方向如何,它都会显示更多文本,直到第二行结束,这是TextView的XML:

<TextView android:id="@+id/ContentViewerDescription"
                android:layout_width="wrap_content" 
                android:layout_height="match_parent"
                android:layout_weight="1" 
                android:ellipsize="end"
                android:maxLines="20"
                android:textColor="#999999"
                android:layout_marginTop="10px"
                android:layout_marginLeft="10px"/>
1个回答

6

android:layout_height="wrap_content" 修改为此值,并删除 android:ellipsize="end"


谢谢,我甚至没有想到match_parent可能与此有关... - nathanjosiah
3
实际上,只需添加 android:ellipsize="end"。 - Jorgesys
3
奇怪,为什么省略号(ellipsize)不能与大于两行的文本兼容? - nmr

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接