最近项目中经常使用到跑马灯的效果,比如说一个通知等等,都可以用跑马灯的效果来实现,也是项目中经常要使用的到,现在我们就来总结归纳一下android项目中如何实现跑马灯的效果,首先第一种就是android自带的跑马灯的效果,直接上代码吧:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:ellipsize="marquee"//设置跑马灯的效果
android:focusable="true"//必须设置为true,获得焦点,这样才会跑马灯的效果
android:focusableInTouchMode="true"//必须设置为true,获得焦点,这样才会跑马灯的效果
android:singleLine="true"//必须是singleLine,如果是lines="1"的话没有效果
android:marqueeRepeatLimit="marquee_forever"//跑马灯的重复设置
android:scrollHorizontally="true"
andr