星空网 > 软件开发 > 操作系统

android TextView多行文本(超过3行)使用ellipsize=end属性无效问题的解决方法

<TextView
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="130px"
android:lineSpacingExtra="2px"
android:textColor="@color/white"
android:textSize="20px"
android:text="@string/desc"
android:maxLines="4"/>          //设定文本最多为4行

 

 

if(mDescTextView.getLineCount() > 4){//判断行数大于多少时改变
int lineEndIndex = mDescTextView.getLayout().getLineEnd(3); //设置第4行打省略号
String text = mDescTextView.getText().subSequence(0, lineEndIndex-3) +"...";
mDescTextView.setText(text);
}




原标题:android TextView多行文本(超过3行)使用ellipsize=end属性无效问题的解决方法

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

世界名牌皮带价格:https://www.goluckyvip.com/tag/64008.html
柬埔寨国旗:https://www.goluckyvip.com/tag/6401.html
抖音社交:https://www.goluckyvip.com/tag/6402.html
dha外国什么牌子好:https://www.goluckyvip.com/tag/64024.html
外国名牌布鞋:https://www.goluckyvip.com/tag/64027.html
产品开发人员:https://www.goluckyvip.com/tag/6403.html
天坛最佳攻略 天坛必玩景点:https://www.vstour.cn/a/408240.html
央视新址为什么会找回:https://www.vstour.cn/a/408241.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流