AlertDialog_简单Demo

效果的实现如右图


AlertDialog.Builder dBuilder = new AlertDialog.Builder(CallPhoneActivity.this);
dBuilder.setTitle("要取消?");
dBuilder.setMessage("提示");           //message是自定义的消息
dBuilder.setCancelable(false);
dBuilder.setPositiveButton("ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub

}
});
// dBuilder.setNegativeButton("no", new DialogInterface.OnClickListener() {
//
// @Override
// public void onClick(DialogInterface dialog, int which) {
// // TODO Auto-generated method stub
//
// }
// });
AlertDialog alertDialog = dBuilder.create();
alertDialog.show();






你可能感兴趣的:(AlertDialog,Android)