简单的文字轮播,效果图如下(事实上是比较慢的,ps 很烂才弄成了这样):
需要两个步骤:
1.复制工具类到项目中
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.annotation.SuppressLint;
import android.widget.TextView;
/**
* author: wu
* date: on 2018/10/13.
* describe:自定义TextView,实现轮播
*/
@SuppressLint("AppCompatCustomView")
public class ForcedTextView extends TextView {
public ForcedTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if (focused) {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
}
public void onWindowFocusChange