跑马灯

建立MarqueeTextView类继承TextView

public class MarqueeTextView extends TextView {
    public MarqueeTextView(Context context) {
        super(context);
    }
    public MarqueeTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    public MarqueeTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
    public boolean isFocused() {
        return true;
    }
}

控件代码必须实现的两个属性

    android:ellipsize="marquee"
    android:singleLine="true"

你可能感兴趣的:(纯代码)