android – TextView多线

我有一个TextView,其中填充了从数据库获取的文本,因此它的lenth是未定义的.

我已经使用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属性不能正常工作.我做错了什么?

谢谢

解决方法

我猜这是由于android:singleLine =“false”这是认值try并将其更改为TRUE 告诉它是否有效.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...