蜂窝方向变化
我有一项活动在方向改变后不应重新创建。我将以下内容添加到清单中的活动声明中:
android:configChanges="orientation"
在 Android 2.3 上,这完美运行。在 HONEYCOMB_MR2 onCreate
上是改变方向时无论如何都会调用。
是否还需要在 HONEYCOMB_MR2 上执行其他操作以防止在方向更改后重新创建活动?
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"
On Android 2.3 this works perfectly. On HONEYCOMB_MR2 onCreate
is called anyway when change the orientation.
Is there something else that needs to be done on HONEYCOMB_MR2 to prevent recreating the activity after an orientation change?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,使用
orientation|screenSize
(?) 会阻止 Honeycomb 上的onCreate
并且(到目前为止)似乎不会破坏以前的 Android 版本中的任何内容。不知道为什么这是必要的,而且我不太理解 文档 关于这个新值。
我怀疑在 HONEYCOMB_MR2 中,方向更改后,活动将其视为两个配置更改:方向和屏幕尺寸。默认情况下,两者都会尝试重新创建活动。
Apparently using
orientation|screenSize
(?) preventsonCreate
on Honeycomb and (so far) does not seem to break anything in previous Android versions.No idea why this is necessary and I don't really understand the documentation about this new value.
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.