Android 中ellipsize属性学习

‘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

一般在新闻的标题中使用

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值