跑马灯文字效果

singleLine 单行显示,设置为true


ellipsize 设置多余文字的显示效果,此处应设置为marquee


marqueeRepeatLimit 文字循环的次数,此处设置为marquee_forever


设置完这些还要设置焦点相关事项


focusable 设置为true


focusableInTouchMode 设置为true


具体代码:

<TextView
	android:id="@+id/tv_7"
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:text="天哥在奔跑天哥在奔跑天哥在奔跑天哥在奔跑"
	android:textColor="#000000"
	android:textsize="24sp"
	android:singleLine="true"
	android:ellipsize="marquee"
	android:marqueeRepeatLimit="marquee_forever"
	android:focusable="true"
	android:focusableInTouchMode="true"/>