本文介紹了在 Android 主屏幕中彈出對話框的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
是否可以通過服務在安卓設備的主屏幕上顯示彈出對話框(AlertDialog)?
Is it possible to show pop up dialog (AlertDialog) in home screen on the android device via services?
推薦答案
您可以使用 Theme.Dialog
主題創建一個 Activity
.在您的 AndroidManifest.xml
文件中,將主題添加到活動中,如下所示:
You could create an Activity
with the Theme.Dialog
theme. In your AndroidManifest.xml
file add the theme to the activity, like this:
<activity android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog"></activity>
從您的服務中只需啟動這個Activity
.您必須使用 Intent.FLAG_ACTIVITY_NEW_TASK
標志開始活動.請參閱如何從服務啟動活動
From your service simply start this Activity
. You will have to start the activity with the Intent.FLAG_ACTIVITY_NEW_TASK
flag. See How to start an Activity from a Service
這篇關于在 Android 主屏幕中彈出對話框的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!