How to create alert dialogs with or without xml as per image below ? sample code will help.
- Seekbar is disabled when checkbox is checked.
For this dialog, I was able to create some short of dialog but, I am not sure how to place check box and its logic if checkbox is checked/uncheckd, seekbar needs to disabled/enabled.
public void ShowDialog()
{
final AlertDialog.Builder popDialog = new AlertDialog.Builder(this);
popDialog.setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
popDialog.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
final SeekBar seek = new SeekBar(this);
seek.setMax( ... );
seek.setProgress(...);
final AlertDialog handle = popDialog.create();
handle.setIcon(android.R.drawable.ic_menu_preferences);
handle.setTitle("Brighness");
handle.setView(seek);
seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){
//Log.d(TAG, "Value of : " + value);
}
public void onStartTrackingTouch(SeekBar arg0) {
//Log.d(TAG, "onStartTrackingTouch");
}
public void onStopTrackingTouch(SeekBar seekBar) {
//Log.d(TAG, "onStopTrackingTouch");
}
});
handle.show();
}
- Auto line is dimmed when seekbar is highlighted.
- seekbar is dimmed when Auto line is highlighted.
I have checked other questions, those are more about custom dialogs : How to create a Custom Dialog box in android? But, None of these are giving me clear idea so, I am asking this specific question.
Aucun commentaire:
Enregistrer un commentaire