音乐播放器中seekbar控件的监听代码:
seekbar = (SeekBar)findViewById(R.id.seekbar);
seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Log.i(TAG, "music play");
play();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
Log.i(TAG, "music pause");
pause();
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
if (fromUser){
seekbar_change(progress);
}
}
});