android fragment屏幕旋转不执行onConfigurationChanged方法

android cruise 5年前 (2016-02-22) 2640次浏览 已收录 0个评论 扫描二维码

自学是一段痛苦的路程。。。。  但我们在痛苦中进步



Caution: Beginning with Android 3.2 (API level 13), the “screen size” also changes when the device switches between portrait and landscape orientation. Thus, if you want to prevent runtime restarts due to orientation change when developing for API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), you must include the “screenSize” value in addition to the “orientation” value. That is, you must decalare android:configChanges=”orientation|screenSize”. 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).

大概其就是 api level 在13及其以上的时候,在AndroidManifest.xml中要配置 android:configChanges=”orientation|screenSize”.而不仅仅配置android:configChanges=”orientation”

ok,问题解决。 此处并不需要配置 <uses-permission android:name=”android.permission.CHANGE_CONFIGURATION”></uses-permission>



原创不易,请勿随意转载丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:android fragment屏幕旋转不执行onConfigurationChanged方法
喜欢 (0)
分享 (0)
表情 贴图 加粗 删除线 居中 斜体 签到


  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址