‘llipsize是处理当文字长度超过TextView可显示的长度的时候,系统处理方式,ellipsize主要有以下几种值:
“start“:省略号显示在开头 “…789”
“end“:省略号显示在结尾 “123…”
“middle“:省略号显示在中间 “12…89”
“marquee“:以横向滚动方式显示(需获得当前焦点时)
“none“:不做任何处理(会将要显示的文字截断)
TextView实现跑马灯效果的实例:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:singleLine="true"
android:textColor="#912CEE"
android:textSize="20sp"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:text="新闻标题新闻标题新闻标题新闻标题"/>
(在一个博客上看到的,博客地址:
http://blog.csdn.net/u012702547/article/details/49402749)
一般在新闻的标题中使用