如何将TextView配置为在单词的中间截断?
因此,如果我有text =“Some Text”,我希望它显示为“Some Te”,假设宽度支持.
相反,我所看到的是“一些”;即使有足够的空间容纳更多的角色,它也会截断整个单词“Text”.
解决方法
这对我有用:
<TextView android:layout_width="80px" android:layout_height="wrap_content" android:text="Some text" android:background="#88ff0000" android:singleLine="true" android:ellipsize="marquee"/>
或者最后用“……”:
<TextView android:layout_width="80px" android:layout_height="wrap_content" android:text="Some text" android:background="#88ff0000" android:singleLine="true" />
虽然使用android:行不起作用:
<TextView android:layout_width="80px" android:layout_height="wrap_content" android:text="Some text" android:background="#88ff0000" android:lines="1" android:ellipsize="marquee"/>
原文地址:https://www.jb51.cc/android/309405.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。