保持在多个活动同样背景,Android和从活动的过渡中排除 [英] Keeping the same background across multiple activities in Android and excluding them from activity transitions

查看:135
本文介绍了保持在多个活动同样背景,Android和从活动的过渡中排除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作目前Android应用程序。基本上,我有这将被用来创建组面板多ViewFlippers。例如,我有一个ViewFlipper模拟主屏幕环境(即可以通过向左或向右滑动访问的多个板),以及不同的ViewFlipper模拟应用程序启动器(适用于喜爱的应用程序面板,所有的应用程序,设置等) 。我已经通过未使用一组面板时,创建每个组面板,或者在它自己的活动的每个ViewFlipper,以preserve内存中完成这一点。

I'm working on an Android application at the moment. Basically, I have multiple ViewFlippers which will be used to create sets of 'panels'. For example, I have a ViewFlipper to simulate a home screen environment (multiple panels that can be accessed by swiping left or right), as well as a different ViewFlipper to simulate an application launcher (panels for favorite apps, all apps, settings etc). I've done this by creating each set of panels, or each ViewFlipper in it's own activity, to preserve memory when a set of panels aren't being used.

基本上,我想保持在所有的活动相同的背景图片。现在,我知道这可以通过创建一个风格,并在清单中应用它的标签来完成,但我的问题是,背景图像包含在活动过渡动画(我自己的自定义动画已定,但无论如何,用股票过渡动画与否,背景图像包括在内)。

Basically, I want to keep the same background image across all the activities. Now, I know this can be done by creating a style, and applying it in the tags in the manifest, but my issue is that the background image is included in the activity transition animation (my own custom animation has been set, but regardless, using stock transition animations or not, the background image is included).

所以,我是问,有没有办法让整个活动之间切换时,是不是动画的多个活动的共同背景图片?

So, what I am asking is, is there a way to keep a common background image across multiple activities that is NOT animated when switching between activities?

目前,我的风格的xml文件看起来像这样:

At the moment, my style xml file looks like this:

<style name="Theme" parent="android:Theme">
    <item name="android:windowNoTitle">true</item> 
    <item name="android:windowBackground">@drawable/background_port</item> 
</style>

因此​​,大家可以看到,同绘被设置为背景的所有活动,但它包含在活动之间的过渡动​​画,这是我不想要的。我也尝试过机器人:detachWallpaper =真,但在这种情况下,似乎没有用

So as you can see, the same drawable is being set as the background for all activities, but it is included in the transition animations between activities, which I don't want. I also have tried android:detachWallpaper="true", but that seems useless in this case.

我相当Android中code经历过,所以没有必要解释简单的方式事情。如果我不明白的地方,我会问。

I'm fairly experienced in Android code, so no need to explain things in simple manners. If I don't understand something, I'll ask.

感谢您的帮助,这真是AP preciated。

Thanks for all your help, it's really appreciated.

推荐答案

不要使用活动。你只是让你想尝试一个扳手将活动表现就像是集成这样做的超级复杂的东西。使用视图。你说你想用活动来节省内存,但他们不会为你节省内存并在pretty各种方式更重量级的不是简单的看法。享有你可以完全控制你的UI,这基本上是你所要求的事情。如果你想尽可能高效膨胀要显示的时候你正在展示他们的意见,并删除不再显示所以可以GCed视图层次的旧零件。

Don't use activities. You are just making what you want to do super-complicated by trying to wrench an Activity into behaving like it is integrated like that. Use Views. You say you want to use activities to save memory, but they will not save you memory and are in pretty every way more heavy-weight than simple views. With views you have complete control going on in your UI, which is basically what you are asking for. If you want to be as efficient as possible inflate the views you want to have shown at the time you are showing them, and remove the old part of the view hierarchy that is no longer shown so it can be GCed.

这篇关于保持在多个活动同样背景,Android和从活动的过渡中排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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