sencha touch 在安卓中横屏、竖屏切换 应用崩溃问题

时间:2023-12-25 13:11:43

答案来至于 Sencha Touch 交流 @周旭

这是由于横竖屏转换导致activity重跑onCreate方法导致的,有两种解决方案:
1、横竖屏转换的时候不要重新跑onCreate方法,这个可以在manifest.xml的对应activity中增加这个属性:“android:configChanges="orientation|screenSize"”;
2、禁止横竖屏转换,在manifest.xml的对应activity中增加这个属性“android:screenOrientation="landscape"”或者“android:screenOrientation="portrait"”。