简体   繁体   English

将父活动的自定义对话框覆盖到所有视图,包括android中的子活动

[英]To overlay a custom dialog for parent Activity to all views including child activity in android

I need to show a custom dialog overlays over all child activities. 我需要显示一个覆盖所有子活动的自定义对话框。 But that dialog's base context is background. 但是该对话框的基本上下文是背景。 Is it possible?. 可能吗?。 This is used for custom lock to whole application after wake up(Screen On). 唤醒(屏幕打开)后,用于自定义锁定整个应用程序。 I have a broad cast receiver to manage that. 我有一个广泛的演员来管理。 But that receiver is registered through parent activity. 但是该接收者是通过父活动注册的。 When the screen go to sleep from parent activity that dialog/process executes correctly. 当屏幕从父级活动进入睡眠状态时,对话框/进程将正确执行。 But the screen go to sleep from child activity that dialog shows background of child activity, when I will back to the parent activity then that shows. 但是屏幕从对话框显示儿童活动的背景的儿童活动中进入睡眠状态,当我回到父活动然后显示时。 I think this occurred on dialog's context. 我认为这是在对话框的上下文中发生的。

You need to use an Activity instead of a Dialog . 您需要使用Activity而不是Dialog Set your Activity theme to emulate a Dialog in the manifest. 设置您的Activity主题以模拟清单中的Dialog

Example - AndroidManifest.xml: 示例 -AndroidManifest.xml:

android:theme="@android:style/Theme.Dialog"

Then, you will have more flexibility and control over its display. 然后,您将具有更大的灵活性并可以控制其显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM