您好,在 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模板网!