Android开发textview中跑马灯效果
16lz
2021-12-04
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:focusable ="true" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:focusableInTouchMode="true" android:scrollHorizontally="true" android:textSize="24dp" android:text="@string/hello" android:background="@drawable/bg" />
其中实现跑马灯(学过HTML的 应该清楚Marquee滚动)的关键代码为:
<!--激活焦点--> android:focusable="true" <!--单行显示-->android:singleLine="true"<!--这里设置为超出文本后滚动显示-->android:ellipsize="marquee"<!--这个是设置滚动几次,这里是无限循环--> android:marqueeRepeatLimit="marquee_forever" <!--TouchMode模式的焦点激活-->android:focusableInTouchMode="true" <!--横向超出后是否有横向滚动条-->android:scrollHorizontally="true"
更多相关文章
- 垂直跑马灯、滚动通知
- 横向滚动条的设置
- Android(安卓)之Tab
- android 水平 垂直 滚动
- Android(安卓)ProgressBar 设置滚动的图标
- Android(安卓)ScrollView去掉滚动条及ScrollView属性
- Android(安卓)ScrollView去掉滚动条及ScrollView属性
- TextView跑马灯效果
- android群英传笔记--第四章--ListView使用技巧(一)