首页 > 代码库 > Activity屏幕旋转时被销毁

Activity屏幕旋转时被销毁

之前的一个Activity的设置为android:configChanges="orientation|keyboardHidden",为保证屏幕旋转时不会重新调用各生命周期

后在修改了sdkVersion时,发现切屏时该Activity被销毁

compileSdkVersion buildToolsVersion

需要再加上ScreenSize可修复此问题

<activity
   android:name=".MyApp"
   android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|screenSize"
   android:label="@string/app_name"
   android:launchMode="singleTop"
   android:screenOrientation="behind"
   android:theme="@style/Theme.NoTitleBar.Fullscreen.Activity.Main" >
</activity>


Activity屏幕旋转时被销毁