同样是由于SDK版本引发的问题。版本高的更加严谨,限制更多。
"orientation " | The screen orientation has changed — the user has rotated the device. Note: If your application targets API level 13 or higher (as declared by the |
"screenSize " | The current available screen size has changed. This represents a change in the currently available size, relative to the current aspect ratio, so will change when the user switches between landscape and portrait. However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device). Added in API level 13. |
So,大意就是SDK版本13或以上的,需要同时用orientation与screenSize。因为当设备横竖屏切换时,相应的屏幕大小也改变了。所以在Activity配置中正确写法为
android:configChanges="orientation|screenSize"
同时,我们可以知道screenSize这个配置改变并不会导致Activity的reStart。