在android中显示来自后台服务的弹出窗口

show pop-up from background service in android(在android中显示来自后台服务的弹出窗口)
本文介绍了在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

推荐答案

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

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How To Create a Rotating Wheel Control?(如何创建转轮控件?)
How to avoid restarting activity when orientation changes on Android(如何在 Android 上的方向更改时避免重新启动活动)
Screen orientation lock(屏幕方向锁定)
Strange behavior with android orientation sensor(android方向传感器的奇怪行为)
Android: Rotate image in imageview by an angle(Android:将imageview中的图像旋转一个角度)
Activity restart on rotation Android(旋转Android上的活动重启)