码迷,mamicode.com
首页 > 移动开发 > 详细

android:configChanges不被调用的问题

时间:2015-07-13 21:56:47      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

同样是由于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 minSdkVersion and targetSdkVersion attributes), then you should also declare the "screenSize" configuration, because it also changes when a device switches between portrait and landscape orientations.

"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。

android:configChanges不被调用的问题

标签:

原文地址:http://www.cnblogs.com/Traveller-Leon/p/4643830.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!