添加监听,使得返回,dialog不消失
DialogInterface.OnKeyListener keylistener= new DialogInterface.OnKeyListener() {
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode== KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
return true;
} else {
return false;
}
}
};
dialog.setOnKeyListener(keylistener);
网友评论