TextView的:得到它不尊重截断单词之间的空格 [英] TextView: Get it to truncate without respect to spaces between words

查看:711
本文介绍了TextView的:得到它不尊重截断单词之间的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何配置一个TextView在一个字的中间截断?

How do you configure a TextView to truncate in the middle of a word?

所以,如果我有文本=一些文本我希望它显示为有些特假设宽度支持。

So if I have text="Some Text" I want it to show as "Some Te" assuming the width supports that.

而不是什么我看到的是有些其截断整个单词文本,即使有足够的空间,一对夫妇多个字符。

What instead I'm seeing is "Some"; its truncating the entire word "Text" even though there is plenty of space for a couple more characters.

推荐答案

下面是我工作:

<TextView 
    android:layout_width="80px"
    android:layout_height="wrap_content"
    android:text="Some text"
    android:background="#88ff0000"
    android:singleLine="true"
    android:ellipsize="marquee"/>

或用......结尾:

Or with "..." at the end:

<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"/>

这是最有可能的一个bug,我相信我已经看到了有关一些bug报告。

This is most likely a bug and I believe I've seen some bug report about that.

这篇关于TextView的:得到它不尊重截断单词之间的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆