Dialog 要在Activity 销毁前 dismiss()掉,不然就窗体溢出
/退出提示
protected void showExitDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("提示");
builder.setMessage("您确定要退出么?");
builder.setNegativeButton("取消", null);
builder.setPositiveButton("退出", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MainActivity.this.finish();
dialog.cancel();//取消dialog,或dismiss掉
}
});
if (!isFinishing()) {
builder.create().show();
}