我尝试了来自堆栈的搜索栏步骤值问题的几个解决方案,不幸的是,它不适用于我的情况。我的问题的最大数量是1,000,000,000。每个步骤增加1000.问题是它不会逐渐增加1000。
public class MainActivity extends AppCompatActivity {
private SeekBar mSb;
private TextView mTv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSb = (SeekBar) findViewById(R.id.sb_a);
mTv = (TextView) findViewById(R.id.textView);
mSb.setMax(1000000);
mSb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
double iPoint ;
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
iPoint=progress*1000;
if(seekBar.getProgress()==0){
mTv.setText(String.valueOf(0));
}else{
mTv.setText(String.valueOf(iPoint));
}
}
@Override
public void onStartTrackingTouch (SeekBar seekBar){
}
@Override
public void onStopTrackingTouch (SeekBar seekBar){
}
});
}
}