效果展示:
注解:
<!--android:ellipsize="marquee" 定义跑马灯的效果-->
<!--android:focusable="true" 获取聚焦功能-->
<!--android:focusableInTouchMode="true" 在触屏手机获取聚焦-->
<!--android:marqueeRepeatLimit="marquee_forever" 字体永远滚动-->
<!--android:singleLine="true" 始终是单行-->
TextView控件:
<TextView
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="在这里居住了一天又一天,你认为这里就是世界的中心。你相信一切都永不会改变。
然后你离开了,一年,两年,当你回来时,一切都变了。那条线断了,你所寻找的并不是这里。
你只能再次离开很长时间……很多年……直到你能回来寻找你的人们,你出生的土地。但是现在不可能。现在你比我还要瞎。"/>