在android中显示来自后台服务的弹出窗口 [英] show pop-up from background service in android

查看:26
本文介绍了在android中显示来自后台服务的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,在 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

推荐答案

有几个选项.您可以使用主题并使活动的外观和行为类似于对话框(如 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中显示来自后台服务的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆