Ker*_*rry 0 android android-configchanges android-orientation
我在应用程序中捕获方向更改时遇到问题.我希望防止在重新定位设备时重新启动我的应用表单.
我的应用程序中共有3个活动(第三个是FragmentActivity).主要的用户交互是通过FragmentActivity.
我更改了清单,以便所有活动都具有以下属性:
android:configChanges="orientation"
我还在onConfigurationChanged()所有活动中重写了该方法,并查看它是否实际上被调用我已经包含了一个Log.i()语句但是没有任何报告.
我正在使用模拟器对此进行测试,并且当我执行CTRL + F12时会报告方向更改.
I/ActivityManager(67):配置已更改:{scale = 1.0 imsi = 310/260 loc = en_US touch = 3 keys = 2/1/2 nav = 3/1 orien = 1 layout = 34 uiMode = 17 seq = 10}
我有什么东西在迷茫吗?
来自:http://developer.android.com/guide/topics/resources/runtime-changes.html
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).