从收盘于外部触摸$​​ P $ pvent Android的活动对话框对话框、pvent、Android

由网友(先生眼里没我)分享简介:我有一个使用Theme.Dialog的风格,使得它在另一个活动的浮动窗口的活动。然而,当我点击对话窗口外(在后台活动),在对话框关闭。我怎样才能制止这种行为?I have an activity that is using the Theme.Dialog style such that it is a floati...

我有一个使用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:

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)

阅读全文

相关推荐

最新文章