当前位置: 代码迷 >> Android >> android不获取焦点也可以兑现跑马灯效果
  详细解决方案

android不获取焦点也可以兑现跑马灯效果

热度:68   发布时间:2016-05-01 19:49:26.0
android不获取焦点也可以实现跑马灯效果

public class MarqueeTextView extends TextView{
?private boolean mMarquee = false;

?public MarqueeTextView(Context context, AttributeSet attrs) {
??super(context, attrs);
?}

?public void setMarquee(boolean marquee) {
??mMarquee = marquee;
?}

[email protected]
?public void onFocusChanged(boolean focused, int direction,Rect previouslyFocusedRect) {
??if (focused){
???super.onFocusChanged(focused, direction, previouslyFocusedRect);
??}
?}

[email protected]
?public void onWindowFocusChanged(boolean focused) {
??if (focused){
???super.onWindowFocusChanged(focused);
??}
?}

[email protected]
?public boolean isFocused() {
??return mMarquee;
?}

}

  相关解决方案