我想知道是否有人知道如何在原生 Android 屏幕上弹出对话框屏幕?
I was wondering if anyone can tell if how to pop a dialog screen up over a native Android screen?
我目前有一个应用程序可以捕获拨出呼叫并停止它,然后我想弹出一个对话框,该对话框将从拨号器屏幕接管并提醒用户尝试呼叫已被阻止并允许他们有一些对话框中的新选项.
I currently have an application that traps an outgoing call and stops it, I then want to pop up a dialog that would take over from the dialler screen and alert the user that there attempt to call has been blocked and allow them have some new options from the dialog.
我知道有些人会说我应该改用通知,但我知道这不是它应该工作的方式,我需要能够在通话被困时弹出一个对话框.
I know that some people will say that I should use notifications instead but I'm aware of that and its not the way that it should work, I need to be able to pop up a dialog when the call gets trapped.
这是我目前的对话代码
AlertDialog LDialog = new AlertDialog.Builder(context)
.setTitle("Call Blocked")
.setMessage("Call Blocked, reroute call?")
.setPositiveButton("ok", null).create();
LDialog.show();
我想我必须以某种方式让上下文成为拨号器屏幕的上下文?
I presume I have to somehow get the context to be that of the dialler screen?
谁能提供任何帮助和帮助或教程链接?
Can anyone offer any help and assistance or links to tutorials?
提前致谢
对于我的应用程序,我使用了一个带有 Dialog
主题的活动.您可以在清单文件中声明主题:
For my application I used an activity with the Dialog
theme.
You can declare the theme in the manifest file :
<activity android:name="PopupActivity"
android:launchMode="singleInstance" android:excludeFromRecents="true"
android:taskAffinity="" android:theme="@android:style/Theme.Dialog" />
launcheMode="singleInstance"
和 taskAffinity=""
.否则,用户可能会单击后退按钮并返回到应用程序的上一个活动.excludeFromRecents="true"
避免您的弹出窗口出现在最近的任务中(长按主页)theme="@android:style/Theme.Dialog"
设置对话框主题.
launcheMode="singleInstance"
and taskAffinity=""
if your popup is detached from your main application. Otherwise user may click the back button and return to the previous activity of your application.excludeFromRecents="true"
to avoid your popup to appear in recent tasks (long press home)theme="@android:style/Theme.Dialog"
to set the Dialog theme.这篇关于Android - 如何在本机屏幕上显示对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!