用textview实现跑马灯的效果;
<com.example.dialoge.MyTextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:singleLine="true"
android:focusable="true"
android:ellipsize="marquee"
android:focusableInTouchMode="true"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
package com.example.dialoge;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewDebug.ExportedProperty;
import android.widget.TextView;
public class MyTextView extends TextView {
public MyTextView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
public MyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public MyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
@ExportedProperty(category = "focus")
public boolean isFocused() {
// TODO Auto-generated method stub
return true;
}
}