实现TextView跑马灯效果,如何控制文本滚动的速度?
layout文件
<com.example.marqueetextview.MarqueeTextView
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/marquee"/>
public class MarqueeTextView extends TextView { public MarqueeTextView(Context context) { super(context); // TODO Auto-generated constructor stub } public MarqueeTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } public MarqueeTextView(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } //实现跑马灯特效的关键 @Override public boolean isFocused() { return true; } }