1)ProgressBar (一般进度条,例如:下载进度条)
2)SeekBar(拖动条,适用于音乐,视频播放进度条)
3)RatingBar(星星数量级别评价条)
public class MainActivity extends Activity implements OnSeekBarChangeListener{
private SeekBar sBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sBar=(SeekBar) findViewById(R.id.seekBar1);
sBar.setOnSeekBarChangeListener(this);
}
/**进度改变时执行此方法*/
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
Log.i("TAG", "onProgressChanged");
}
/**按下(开始触摸)seekBar时*/
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
int startProgress=
seekBar.getProgress();
Log.i("TAG", "startProgress="+startProgress);
}
/**抬起(停止触摸)seekBar时*/
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
int stopProgress=
seekBar.getProgress();
Log.i("TAG", "stopProgress="+stopProgress);
}
}
QQ群号172660439.png
网友评论