Android TextView跑马灯效果
2015-02-23 21:03
399 查看
TextView跑马灯简单效果
<!--简单示例--> <TextView android:text="@string/longWord" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView1" android:ellipsize="marquee" android:singleLine="true" android:focusable="true" android:focusableInTouchMode="true" />
TextView跑马灯效果的几个常用属性,其中ellipsize、singleLine、focusable、focusableInTouchMode 这几个是必须的,其他可选
<!--激活焦点--> android:focusable="true" <!--单行显示--> android:singleLine="true" <!--这里设置为超出文本后滚动显示--> android:ellipsize="marquee" <!--这个是设置滚动几次,这里是无限循环--> android:marqueeRepeatLimit="marquee_forever" <!--TouchMode模式的焦点激活--> android:focusableInTouchMode="true" <!--横向超出后是否有横向滚动条--> android:scrollHorizontally="true"
效果图:
<TextView android:text="@string/longWord" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView1" android:ellipsize="marquee" android:singleLine="true" android:focusable="true" android:focusableInTouchMode="true" /> <sh.geeko.marqueetext.marqueeText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/textView2" android:text="@string/longWord" android:layout_below="@id/textView1" android:layout_marginTop="20dp" android:ellipsize="marquee" android:singleLine="true" android:focusable="true" android:focusableInTouchMode="true" />
View Code
这里我们来看下具体的实现效果:
源码下载
相关文章推荐
- [Android1.5]TextView跑马灯效果
- [Android1.5]TextView跑马灯效果
- Android三种方式实现TextView跑马灯效果
- Android使用TextView跑马灯效果
- 【Android】TextView跑马灯效果
- Android TextView跑马灯效果实现
- Android TextView跑马灯效果
- Android三种方式实现TextView跑马灯效果
- [Android1.5]TextView跑马灯效果
- Android TextView跑马灯效果
- android 之 textview跑马灯效果(笔记)
- android TextView跑马灯效果
- Android TextView跑马灯效果
- android textview跑马灯效果实现
- Android TextView跑马灯效果
- [Android1.5]TextView跑马灯效果
- xamarin android TextView跑马灯效果和EditText焦点冲突的问题
- [Android1.5]TextView跑马灯效果
- Android学习总结——TextView跑马灯效果
- 天天记录 - Android TextView跑马灯效果