首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2012-06-28 
android不获取焦点也可以实现跑马灯效果public class MarqueeTextView extends TextView{?private boolean

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;
?}

?@Override
?public void onFocusChanged(boolean focused, int direction,Rect previouslyFocusedRect) {
??if (focused){
???super.onFocusChanged(focused, direction, previouslyFocusedRect);
??}
?}

?@Override
?public void onWindowFocusChanged(boolean focused) {
??if (focused){
???super.onWindowFocusChanged(focused);
??}
?}

?@Override
?public boolean isFocused() {
??return mMarquee;
?}

}

热点排行