問題描述
您好,在 android 中可以從后臺運行服務顯示彈出對話框嗎?答案是肯定的,而不是我該怎么做
Hi it is possible in android to show pop-up dialog from background running service? and answer is positive than how can i do that
推薦答案
有幾個選項.您可以使用主題并使活動的外觀和行為類似于對話框(如 <activity> 的 android:theme
屬性設置為 @android:style,使 Android Activity 看起來像對話框">this question)/Theme.Dialog
或清單中的自定義主題.
There are several options. You can use a theme and make an activity look and behave like a dialog (as in this question) by setting the android:theme
attribute of your <activity>
to @android:style/Theme.Dialog
or a customized theme in your manifest.
或者,您可以通過將主題設置為 @android:style/Theme.Translucent.NoTitleBar
創建半透明活動,然后從活動中啟動常規對話框.正如對問題答案之一的評論所建議的那樣,在這種情況下,只要確保在對話框被關閉時 finish()
半透明活動.
Alternatively, you could create a translucent activity by setting the theme to @android:style/Theme.Translucent.NoTitleBar
and then launch a regular dialog from the activity. As the comments on one of the answers to the question advise, in this case just make sure to finish()
the translucent activity whenever the dialog is dismissed.
這篇關于在android中顯示來自后臺服務的彈出窗口的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!