在我的应用程序中,我有一个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
};
}
有人可以给我一些提示/代码怎么办?
谢谢!