从收盘于外部触摸$​​ P $ pvent Android的活动对话框 [英] Prevent Android activity dialog from closing on outside touch

查看:123
本文介绍了从收盘于外部触摸$​​ P $ pvent Android的活动对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Theme.Dialog的风格,使得它在另一个活动的浮动窗口的活动。然而,当我点击对话窗口外(在后台活动),在对话框关闭。我怎样才能制止这种行为?

I have an activity that is using the Theme.Dialog style such that it is a floating window over another activity. However, when I click outside the dialog window (on the background activity), the dialog closes. How can I stop this behaviour?

推荐答案

这可以帮助你。这是一种方法来处理触摸之外的事件:

This could help you. It is a way to handle the touch outside event:

<一个href="http://stackoverflow.com/questions/4650246/how-to-cancel-an-dialog-themed-like-activity-when-touched-outside-the-window/5831214#5831214">How取消一个对话为主题的活动一样,当窗外感动?

通过捕获事件,无所事事,我想你可以prevent闭幕。但令人奇怪的虽然是你的活动对话框的默认行为应该是不可以关闭自己,当你触摸之外。

By catching the event and doing nothing, I think you can prevent the closing. But what is strange though, is that the default behavior of your activity dialog should be not to close itself when you touch outside.

(PS:在code使用WindowManager.LayoutParams)

(PS: the code uses WindowManager.LayoutParams)

这篇关于从收盘于外部触摸$​​ P $ pvent Android的活动对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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