xml文件:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:singleLine="true"
android:text="这是一个会讲段子的程序员写的跑马灯效果,真的可以跑起来" />
要实现跑马灯的效果并不难,只需要在Textview中添加这么几行代码即可:
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:singleLine="true"