Orientation change in Honeycomb

浪尽此生 提交于 2019-11-27 14:38:43

问题


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?


回答1:


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"

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.



来源:https://stackoverflow.com/questions/6968105/orientation-change-in-honeycomb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!