Android实现文字显示跑马灯效果
2014-11-08 17:18
633 查看
(1)单个TextView实现跑马灯效果
(2)多个Textview实现跑马灯效果
自定义一个类MarqueeText
<TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:text="@string/textContent" />
</pre><pre name="code" class="html">其中 <string name="textContent">不过,他想,我的钓线深度很精确,只不过是我走运而已。可是谁知道呢?也许就在今天呢。每一天都是个崭新的日子。走运固然不错,不过我宁可保持精确。那样,机会来临时,你已经做好了准备。但是人不是为打败而生的,一个人可以被毁灭,却不能被打败。----《老人与海》</string>
(2)多个Textview实现跑马灯效果
自定义一个类MarqueeText
package com.******.marqueetextview; import android.content.Context; import android.util.AttributeSet; import android.widget.TextView; public class MarqueeText extends TextView { public MarqueeText(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } public MarqueeText(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } public MarqueeText(Context context) { super(context); // TODO Auto-generated constructor stub } @Override <strong>public boolean isFocused() { // TODO Auto-generated method stub return true; }</strong> }
<com.******.marqueetextview.MarqueeText android:id="@+id/text5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:text="@string/textContent" />
相关文章推荐
- Android实现多个TextView同时显示跑马灯效果
- Android 文字自动滚动(跑马灯)效果的两种实现方法[特别好使]
- android 文字超出控件宽度时,自动滚动显示,类似跑马灯效果
- Android 文字自动滚动(跑马灯)效果的两种实现方法
- Android:TextView文字跑马灯的效果实现
- Android 文字自动滚动(跑马灯)效果的两种实现方法
- Android中继承TextView实现文字的跑马灯效果
- Android实现文字逐字显示出来效果
- Android 文字自动滚动(跑马灯)效果的两种实现方法[特别好使]
- Android实现多个TextView同时显示跑马灯效果
- Android中TextView实现文字跑马灯效果(滚动轮播)
- Android----Android之TextView实现文字过长时省略部分或者滚动显示 (跑马灯)
- android显示TextView文字的倒影效果实现代码
- Android 文字自动滚动(跑马灯)效果的两种实现方法
- Android实现多个TextView同时显示跑马灯效果
- Android 文字自动滚动(跑马灯)效果的两种实现方法
- Android基于ViewFilpper实现文字LED显示效果示例
- android使用TextView实现文字的跑马灯效果
- Android 文字自动滚动(跑马灯)效果的两种实现方法
- Android 文字自动滚动(跑马灯)效果的两种实现方法