在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 target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
appearance().setBackgroundImage Not Working On Custom Class(外观().setBackoundImage在自定义类上不起作用)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)