在蜂窝方向变化 [英] Orientation change in Honeycomb
问题描述
我有不应该的方向改变后重新创建活动。我增加了以下内容清单中的活性声明:
I have an activity that shouldn't be recreated after an orientation change. I added the following to the activity declaration in the manifest:
android:configChanges="orientation"
在Android 2.3的这个完美的作品。在<一个href="http://developer.android.com/reference/android/os/Build.VERSION_$c$cS.html#HONEYCOMB_MR2">HONEYCOMB_MR2 的onCreate
被称为反正当更改方向。
On Android 2.3 this works perfectly. On HONEYCOMB_MR2 onCreate
is called anyway when change the orientation.
是否有需要在HONEYCOMB_MR2做prevent重新创建活动的方向改变后的东西?
Is there something else that needs to be done on HONEYCOMB_MR2 to prevent recreating the activity after an orientation change?
推荐答案
显然,使用定位|(?)屏幕尺寸
prevents 的onCreate
对蜂窝(到目前为止)似乎并没有打破previous的Android版本的任何东西。
Apparently using orientation|screenSize
(?) prevents onCreate
on Honeycomb and (so far) does not seem to break anything in previous Android versions.
android:configChanges="orientation|screenSize"
不知道为什么,这是必要的,我真的不明白文档这个新的价值。
我怀疑,在HONEYCOMB_MR2在一个方向变化的活动认为,这两个配置的变化:方向和屏幕尺寸。而且两者都试图在默认情况下重新创建活动。
I suspect that in HONEYCOMB_MR2 upon an orientation change the activity considers this as two config changes: orientation and screen size. And both attempt to recreate the activity by default.
这篇关于在蜂窝方向变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!