果然,看了 api google 不但做了,而且做的更好,
看到 EditText 里有个 setEllipsize 方法
public void setEllipsize (TextUtils.TruncateAt where)
方法参数 TextUrils.TruncateAt?? :
看到了吧,不但提供 后面加 ... 前面,中间 也可以,~~~
Summary
Enum Values
TextUtils.TruncateAt ??? END
TextUtils.TruncateAt ?? MARQUEE
TextUtils.TruncateAt ?? MIDDLE
TextUtils.TruncateAt ??? START
哦耶,搞定。
——————————
可能你要问 如果?? layout 的 xml 文件里 怎么 弄呢?
Where to ellipsize text. Must be one of the following constant values. ? Constant Value: 16842923 (0x010100ab) android:layout_width="wrap_content"?????? 这个是?? 必须?? 的public static final int ellipsize
ConstantValueDescription none0 ? start1 ? middle2 ? end3 ? marquee4 ?
<TextView
?? android:id="@+id/item_text"
?? android:layout_width="wrap_content"
?? android:layout_height="wrap_content"
?? android:textSize="16sp"
?? android:singleLine="true"
??android:ellipsize="end"
?? >
?? </TextView>
这里 要强调两点 一定要注意,不然?? 你就无缘看到 谷歌给你 加上的 ... 了
android:singleLine="true"??????这个不必须, 因为 系统可能会两行 然后 加...
????????????????????????????????但是 一会儿一行,一会儿两行的 界面,估计不太能让人接受。