android 在文本视图

编程入门 行业动态 更新时间:2024-10-24 14:16:33
本文介绍了android 在文本视图 _EDIT 末尾附加 '...'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个 lsit 视图,我需要添加一些文本.在适配器中,我需要在最后添加 ...,我使用了以下内容当我给

I have a lsit view and i that i need to add some text. in the adapter, I need to append ... at the end and i used the following when i give

android:ellipsize="end"

在只显示 2 行例如:
asdnfsdfdsf asdfsdfasdf
sdfsd sdfsdf sdfsd 广告...

in the only shows 2 line eg:
asdnfsdfdsf asdfsdfasdf
sdfsd sdfsdf sdfsd ad...

当我给

android:ellipsize="start"

它是这样的:
asdnfsdfdsf asdfsdfasdfd
...sdfsd sdfsdf sdfsd 广告

it is as :
asdnfsdfdsf asdfsdfasdfd
...sdfsd sdfsdf sdfsd ad

我使用的完整代码:

<TextView  android:layout_width="wrap_content" android:background="#016A7D"

   android:layout_height="80dp" android:textColor="#000000"

    android:maxLines="4"          

    android:id="@+id/list_report_desciption" 

    android:ellipsize="end"

/>我得到的输出是:

一个更智能的星球究竟会是什么样子
看起来像?IT如何变化?一个...

What exactly will a smarter planet
look like? How's IT changing? A...

实际上它包含超过 6 行
有什么我需要设置的,以便我需要获得 3 行
谢谢

actually it contains more than 6 lines
Is there any thing i need to set so that i need to get 3 lines
Thanks

推荐答案

没有什么对我有用:-(
我只是固定了长度.将字符串切成该长度并在其后附加...".
现在它为我工作.

Nothing worked for me:-(
I just fixed the length. Cut the string in that length and append '...' after that.
Now its working for me.

这篇关于android 在文本视图 _EDIT 末尾附加 '...'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 20:14:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/921589.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   文本   android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!