无法获取省略号工作在Android [英] Can't get ellipsis to work on Android

查看:184
本文介绍了无法获取省略号工作在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TextView。我想如果超过其可用的宽度长到ellipsize。这并不工作,除非输入字符串没有空格...谁能提供这个工作的例子吗?我已经尝试了不同的组合:

I have a TextView. I want it to ellipsize if longer than its available width. This does not work unless the input string has no spaces... can anyone provide an example of this working? I've tried different combinations of:

SINGLELINE =真  MAXLINES =1  scrollHorizo​​ntally =假

singleLine="true" maxLines="1" scrollHorizontally="false"

这些都不产生任何影响。再次,如果我提供一个其中有没有空格的字符串,然后省略号正确显示。我在想什么?我已经在1.5,1.6,2.0,都同样的问题试过这一点。

none of these have any effect. Again, if I supply a string that has no spaces in it, then the ellipsis appears correctly. What am I missing? I've tried this on 1.5, 1.6, 2.0, all same problem.

感谢

推荐答案

Ellipsize坏了(去的上的错误报告票,特别是因为他们声称这不是重复性的),所以你必须使用一个较小的黑客攻击。用途:

Ellipsize is broken (go vote on the bug report, especially since they claim it's not reproducible) so you have to use a minor hack. Use:

android:inputType="text"
android:maxLines="1"

您要ellipsize什么。另外,不要使用,因为1.5 pcated 单线,它已经去$ P $。

on anything you want to ellipsize. Also, don't use singleLine, it's been deprecated since 1.5.

这篇关于无法获取省略号工作在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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