0
我使用的是一個seekbar,其最大值是30,進度爲1 我需要seekbar從值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是
<SeekBar
android:id="@+id/your_dialog_seekbar"
android:layout_width="0dp"
android:layout_weight="3"
android:paddingTop="7dp"
android:layout_height="wrap_content"
>
</SeekBar>