如何处理AlertDialog关闭事件? [英] How to handle AlertDialog close event?

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

问题描述

使用外部触摸事件关闭AlertDialog时是否存在回调?我启用了"setCanceledOnTouchOutside(true)".我想使用外部触摸事件关闭AlertDialog后,设置特定视图的可见性.有什么想法吗?

如果有帮助,我正在Fragment内使用AlertDialog.Builder().

解决方案

一个而是android.com/reference/android/app/AlertDialog.Builder.html#setOnCancelListener%28android.content.DialogInterface.OnCancelListener%29"rel =" nofollow> OnCancelListener .

Is there a callback when an AlertDialog is closed using the touch outside event? I have this enabled "setCanceledOnTouchOutside(true)". I want to set a visibility of a specific view once the AlertDialog is closed using the touch outside event. Any ideas?

I am using the AlertDialog.Builder() inside a Fragment if that helps.

解决方案

an OnDismissListener seems most appropriate, but it requires a relatively high API level, so you might need to stick with an OnCancelListener instead.

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

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