您的位置:首页 > 移动开发 > Android开发

真正实现TextView跑马灯效果

2011-08-18 16:00 375 查看
 

package com.lewa.launcher.widget.weather;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

public class LewatekWeatherTextView extends TextView {

public LewatekWeatherTextView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}

@Override
public boolean isFocused() {
//最关键的代码在此
return true;
}

}


 

最后xml文件中关于TextView必须的3个属性:

android:singleLine="true"

android:ellipsize="marquee"

android:marqueeRepeatLimit="marquee_forever"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息