我无法在搜索栏中添加1000的步长值。
以下是我的代码:
discreteSeekBar.setOnProgressChangeListener(new DiscreteSeekBar.OnProgressChangeListener() {
@Override
public void onProgressChanged(DiscreteSeekBar seekBar, int value, boolean fromUser) {
int val= seekBar.getProgress();
Log.i("Debug",""+value);
DecimalFormat formatter = new DecimalFormat();
budget = ""+value;
txtSelected.setText("Rs "+ formatter.format(value));
}
@Override
public void onStartTrackingTouch(DiscreteSeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(DiscreteSeekBar seekBar) {
}
});
如何获得数千的步数?
答案 0 :(得分:0)
TextView seek = (TextView)layout.findViewById(R.id.seek);
SeekBar seekBar = (SeekBar)layout.findViewById(R.id.seekbar);
seekBar.setProgress(0);
seekBar.incrementProgressBy(1000);
seekBar.setMax(10000);
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progress = progress / 1000;
progress = progress * 1000;
seek.setText(String.valueOf(progress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});