设置mDialog.setOnCancelListener(listener)
并关闭该Activity
侦听器.
@Override mDialog.setOnCancelListener(new OnCancelListener() { public void onCancel(DialogInterface interface) { this.finish(); } });
或者你可以用OnKeyListener
你的Dialog
.
mDialog.setOnKeyListener(new Dialog.OnKeyListener() { @Override public boolean onKey(DialogInterface interface, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { this.finish(); } return true; } });