只需要在布局中写一个TextView即可
简易版
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#2345"
android:textSize="30dp"
android:textColor="#5f9f9f"
android:padding="5dp"
android:focusableInTouchMode="true"//通过触摸方式获取焦点
android:marqueeRepeatLimit="marquee_forever"//设置跑马灯的重复方式
android:focusable="true"/获取焦点android:singleLine="true" //设置文字只显示一行
android:ellipsize="marquee"// 设置无法显示的文字的显示方式为跑马灯
//注意文字一定要长,否则无效果
android:text="你是晚风渐息星河若隐一场小别离,你是破晓清晨灿烂眼中的光景,你是时光轻轻哼唱,宛若星辉铺满小巷"
/>
跑马灯还有别的写法
详情可看:
https://www.jianshu.com/p/03119bfb0331