最近在做一个盒子应用,有个地方是走马灯。实现方式总结一下(苍蝇也是肉啊)
二话不说先看效果:
就是有焦点的时候需要进行跑马灯效果,没有焦点的时候文字末尾收缩成省略号
有几种实现的方式:
实现方式一:使用TextView,设置相关的属性
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="@dimen/px_positive_410">
<!-- ....此处省略一些 -->
<TextView
...
android:ellipsize="marquee"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever