参考:http://blog.csdn.net/qq_28057577/article/details/52225870
<SeekBar
android:id="@+id/change_surge_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="50" />
max:最大进度
progress:当前进度
surgeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
Toast.makeText(ChangeActivity.this,"slide to change surge",Toast.LENGTH_SHORT).show();
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
Toast.makeText(ChangeActivity.this, "surge is"+surgeSeekBar.getProgress()*2+"%", Toast.LENGTH_SHORT).show();
}
});
onProgressChanges:进度改变时
onStartTrackingTouch:按住SeekBar时
onStopTrackingTouch:放开SeekBar时
网友评论