SeekBar拖动条,是Progress的间接子类
1
SeekBar事件,被拉动时,onProgressChanged会一直被触发
1 public void showSeekBar() { 2 seekBar = (SeekBar) findViewById(R.id.seekBar1); 3 seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { 4 5 @Override 6 public void onStopTrackingTouch(SeekBar seekBar) { 7 // TODO Auto-generated method stub 8 Log.i(TAG, "onStopTrackingTouch"); 9 Toast.makeText(FormActivity.this,10 "current level is " + seekBar.getProgress(), 3000)11 .show();12 }13 14 @Override15 public void onStartTrackingTouch(SeekBar seekBar) {16 // TODO Auto-generated method stub17 Log.i(TAG, "onStartTrackingTouch");18 19 }20 21 @Override22 public void onProgressChanged(SeekBar seekBar, int progress,23 boolean fromUser) {24 // TODO Auto-generated method stub25 Log.i(TAG, "onProgressChanged");26 27 }28 });29 }