Android 让你的SeekBar 也支持长按事件
2010-09-06 08:38:00 来源:WEB开发网*
*/
public interface onChange {
public void onStopTrackingTouch(seekBarDemo seekBar);
public void onStartTrackingTouch(seekBarDemo seekBar);
public void onProgressChanged(seekBarDemo seekBar, int progress,
boolean fromUser);
}
private Handler hand;
private Runnable runable;
private Thread th;
public static int i = 0;
private boolean isStop = false;
public static int pp = 0;
public int index = 0;
public seekBarDemo(Context context) {
this(context, null);
// TODO Auto-generated constructor stub
}
public seekBarDemo(Context context, AttributeSet attrs) {
super(context, attrs);
this.setOnTouchListener(this);
this.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
if (SeekBarChange != null) {
SeekBarChange.onStopTrackingTouch(seekBarDemo.this);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
if (SeekBarChange != null) {
SeekBarChange.onStartTrackingTouch(seekBarDemo.this);
}
}
@Override
public void onProgressChanged(final SeekBar seekBar,
final int progress, boolean fromUser) {
if (SeekBarChange != null) {
SeekBarChange.onProgressChanged(seekBarDemo.this, progress,
fromUser);
}
hand = getHandler(1, seekBarDemo.this, progress);
}
});
/**
* 为runable 赋值
*/
runable = new Runnable() {
@Override
public void run() {
更多精彩
赞助商链接