对其他活动的状元秀活动 [英] Show activity on top of other activity

查看:121
本文介绍了对其他活动的状元秀活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个过程完成时,产生一个通知的应用程序。当点击该通知,将创建一个弹出。弹出窗口实质上是一种活动,是不是全屏幕。

I have an app that produces a notification when a process completes. Upon clicking on the notification, a popup is created. The popup is essentially an activity that isn't full screen.

我的问题是,如果在一个开放的应用程序的顶部,将创建该弹出时,屏幕方向改变,后台应用程序被杀害。
我试图迫使肖像模式(在清单和code)来规避这一而是收出弹出时杀死后台应用程序也是如此。

My issue is that if this popup is created on top of an open application, when the screen orientation changes, the background application is killed. I have attempted to circumvent this by forcing portrait mode (in the manifest and code) but that kills the background app as well when closing out of the popup.

有谁知道如何而不杀死后台程序做到这一点,当配置更改?

Does anyone know how to accomplish this without killing the background app when the configuration changes?

推荐答案

在添加这些行您的清单

 <activity android:name=".Activity"
                 android:configChanges="keyboardHidden|orientation"         
                  android:label="@string/app_name">

然后在你的java code此重写方法实施

then implement in your java code this override method

public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);}

有了这个,你告诉你的应用程序时出现配置的变化做什么(方向的变化让我们说)我有同样的问题。整个活动重新启动,添加此,解决了这个问题。我希望它为你工作了。

With this you are telling your application to do nothing when config changes occur (orientation changes let's say) I had the same problem. The whole activity was restarted, adding this, solved this issue. I hope it does work for you too.

这篇关于对其他活动的状元秀活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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