我正在使用搜索栏,其最大值为30,进度为1。 我需要搜索栏从值8开始,这样如果我们向左搜索,进度不应低于8,它应该保持在值8
SeekBar seek = (SeekBar)dialog.findViewById(R.id.your_dialog_seekbar);
seek.setProgress(8);
seek.incrementProgressBy(1);
seek.setMax(30);
seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
int topsize;
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
TextView t1=(TextView)dialog.findViewById(R.id.df);
t1.setText(String.valueOf(progress));
TextBox = (TextView)findViewById(R.id.t9);
// TextBox.setTextSize(40);
TextBox.setTextSize(TypedValue.COMPLEX_UNIT_SP, progress);
}
});
dialog.show();
XML IS
<SeekBar
android:id="@+id/your_dialog_seekbar"
android:layout_width="0dp"
android:layout_weight="3"
android:paddingTop="7dp"
android:layout_height="wrap_content"
>
</SeekBar>