TextView实现跑马灯效果
2016-01-29 15:25
295 查看
TextView实现跑马灯只需要设置TextView的四个属性:
分别是singleLine设置为true:让内容显示在一行上,不设置会有折行,一行空间不够会自动转到下一行。
ellipsize设置为marquee跑马灯效果,如果设置为start是在开头缩进(开头是省略号),end是在末尾缩进(末尾是省略号),middle是中间缩进(中间是省略号)。
focusable是让TextView获取焦点。
以上即可实现TextView的跑马灯效果。
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World" android:singleLine="true" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true"/>
分别是singleLine设置为true:让内容显示在一行上,不设置会有折行,一行空间不够会自动转到下一行。
ellipsize设置为marquee跑马灯效果,如果设置为start是在开头缩进(开头是省略号),end是在末尾缩进(末尾是省略号),middle是中间缩进(中间是省略号)。
focusable是让TextView获取焦点。
以上即可实现TextView的跑马灯效果。
相关文章推荐
- 排序算法系列:冒泡排序与双向冒泡排序
- Animation动画详解(五)——ValueAnimator高级进阶(一)
- Unity协程(Coroutine)原理深入剖析
- NGUI研究院之Sprite精灵与精灵动画的使用(二)
- 记得自己的大梦想
- 小结1
- 【JSOI2008】【BZOJ1014】火星人prefix
- 【复习笔记】评估假设
- 预处理优化例题
- [Unity3D]脚本中Start()和Awake()的区别
- [BZOJ 1486][HNOI2009]最小圈
- 在Oracle中使用Entity Framework 6 CodeFirst
- AndroidCharts为折线图表添加y坐标
- linux进程间通信的几种机制的比较及适用场合
- 大数据量下高并发同步的讲解
- 分析iOS Crash文件:符号化iOS Crash文件的3种方法
- shell
- Apache Spark Jobs 性能调优(一)
- Animation动画详解(四)——ValueAnimator基本使用
- 七小时 Theano 入门(Day 1)