AlertDialog OnClose事件Android [英] AlertDialog OnClose Event Android

查看:161
本文介绍了AlertDialog OnClose事件Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在四处寻找,但我找不到任何东西,所以我不知道它是否可能,但是有没有办法在关闭alertdialogs时做点什么?

I have been looking around and I couldn't find anything, so I don't know if its possible, but is there a way to do something on close for alertdialogs?

在我的情况下,我在对话框启动时暂停了后台UI作为暂停屏幕。如果单击对话框中的按钮,它将运行onClick的东西,所以我在那里取消暂停,但如果他们点击对话框,它会关闭对话框,但不会运行onClick。无论如何,当他们点击一边时,有什么东西可以运行吗?谢谢!

In my situation, I have the background UI paused while the dialog is up as its a pause screen. If you click the buttons in the dialog it will run the onClick stuff, so I have it unpausing there, but if they click off of the dialog it closes the dialog but doesn't run onClick. Is there anyway to get something to run when they click off to the side? Thanks!

推荐答案

唯一的方法是不使用AlertDialog.Builder而是创建一个PopupWindow子类。

The only way to do this is to not use a AlertDialog.Builder and instead create a PopupWindow sub class.

第37行可以找到一个很好的例子:
https://github.com/lorensiuswlt/NewQuickAction/blob/master/src/net/londatiga/android/PopupWindows.java

A good example may be found here on line 37 : https://github.com/lorensiuswlt/NewQuickAction/blob/master/src/net/londatiga/android/PopupWindows.java

这篇关于AlertDialog OnClose事件Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆