在我的应用程序中,我有一个在对话框中显示的
到目前为止,这是我的代码:
Seekbar
。现在我想设置Seekbar
的间隔和步进值。间隔应为0-250,每个步长应为5分钟。到目前为止,这是我的代码:
public class seekActivity extends Activity implements OnClickListener, OnSeekBarChangeListener {
SeekBar seekbar;
Button button;
TextView textview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//set up main content view
setContentView(R.layout.main);
//this button will show the dialog
Button button1main = (Button) findViewById(R.id.Button01main);
button1main.setOnClickListener(this);
}
public void onClick(View v) {
//set up dialog
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.maindialog);
dialog.setTitle("This is my custom dialog box");
dialog.setCancelable(true);
button = (Button) dialog.findViewById(R.id.Button01);
seekbar = (SeekBar) dialog.findViewById(R.id.seekBar1);
seekbar.setOnSeekBarChangeListener(this);
textview = (TextView) dialog.findViewById(R.id.textView1);
dialog.show();
}
public class SeekBarPreference {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
textview.setText(progress + "");
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
};
}
有谁能给我一些提示或代码,怎样做呢?
谢谢!