Android TextView跑马灯效果
16lz
2021-01-23
例:
<TextView
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="@string/hello"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
/>
解释一下:
android:ellipsize="marquee"
textview中样式是跑马灯效果。
android:marqueeRepeatLimit="marquee_forever"
循环次数,这里是无限循环,可以根据需要写具体的次数,例如5。
android:singleLine="true"
textview中字体单行显示,否则会这行,不会出现跑马灯效果。
android:focusable="true"
android:focusableInTouchMode="true"
使textview获取焦点,这样字体就会自动滚动。
更多相关文章
- Android开发中修改程序字体
- 文字跑马灯效果
- android文字阴影效果设置
- Android TextView投影效果
- Android TextView设置个别字体样式
- android酷炫翻页效果+图形分析