我已经设置了 seek bar 的属性。它到达一个进程,但它的进程没有到达 1,如下图所示
sbpassangers.setProgress(1); //set this at onCreate
xml:
<SeekBar
android:id="@+id/sBpassangers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/tvPassengers"
android:layout_toRightOf="@+id/ivPhone"
android:layout_weight="2"
android:paddingBottom="3dp"
android:paddingLeft="2dp"
android:paddingTop="3dp" />
爪哇代码:
sbpassangers.setProgress(1);
sbpassangers.setMax(sb1.getProgress());
tvtaxipassangers.setText(Integer.toString(1));
//sb1.setMax(9);
//sb1.setProgress(2); // Set it to zero so it will start at the left-most edge
sbpassangers.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
seekBar.setProgress(progress);
if(progress == 0){
seekBar.setProgress(1);
}
tvtaxipassangers.setText(Integer.toString(seekBar.getProgress()));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
});
应该是这样的:
请帮助解决这个问题