WEB开发网
开发学院手机开发Android 开发 Android 让你的SeekBar 也支持长按事件 阅读

Android 让你的SeekBar 也支持长按事件

 2010-09-06 08:38:00 来源:WEB开发网   
核心提示:**/public interface onChange {public void onStopTrackingTouch(seekBarDemo seekBar);public void onStartTrackingTouch(seekBarDemo seekBar);public void onProgressC

*

*/

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() {

上一页  1 2 3 4 5 6  下一页

Tags:Android SeekBar 支持

编辑录入:coldstar [复制链接] [打 印]
赞助商链接