【问题标题】:how to add Continue String Sign like "..." in TextView?如何在 TextView 中添加像“...”这样的继续字符串符号?
【发布时间】:2010-04-02 12:33:56
【问题描述】:

例如,如果我在 TextView 中添加字符串,

this is my string

TextView 最大长度为 4

它应该看起来像在活动 this...t... 中,这意味着如果字符串大小大于最大长度,则字符串在分配的字符串末尾继续符号。

谁能指导我该怎么做,否则我将不得不通过编程在字符串末尾手动添加“...”。

任何帮助将不胜感激。

【问题讨论】:

  • 刚刚意识到this is my string 只包含关键字。

标签: android textview


【解决方案1】:

为您的 TextViews 使用以下内容:

android:ellipsize="end" 
android:singleLine="true"

【讨论】:

  • 对于 TextViews,singleLine 默认不是 true。
【解决方案2】:

可以使用 TextView 的 singleLine 属性:

android:singleLine="true"

【讨论】:

    猜你喜欢
    • 2011-03-26
    • 1970-01-01
    • 2013-08-07
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    • 2017-03-09
    • 1970-01-01
    • 2020-04-15
    相关资源
    最近更新 更多