Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 Android 中捕获弹出关闭事件?我想在用户关闭弹出窗口时执行一些操作。
覆盖OnCancelListener..
OnCancelListener
dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { //do somethiing } });
如果您正在使用,PopupWindow则覆盖PopupWindow.OnDismissListener
PopupWindow
PopupWindow.OnDismissListener