我想测试模拟器上手机的旋转功能,我在各处看到需要使用Ctrl+F11,但这只会旋转模拟器画面,并不会触发配置更改事件或重新绘制活动。
下面是使用Ctrl+F11的效果:
那么,我应该使用什么方法来模拟真实的旋转呢?
我想测试模拟器上手机的旋转功能,我在各处看到需要使用Ctrl+F11,但这只会旋转模拟器画面,并不会触发配置更改事件或重新绘制活动。
下面是使用Ctrl+F11的效果:
那么,我应该使用什么方法来模拟真实的旋转呢?
此外,您还可以执行以下操作:
禁用加速度计控制旋转 - 只需执行一次此操作
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
旋转横向:
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
旋转肖像:
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0
旋转横屏画面:
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:3
翻转颠倒人像:
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:2
如果您拥有WRITE_SETTINGS权限,您可以在Java代码中通过内容提供程序进行写入。http://developer.android.com/tools/help/emulator.html 这个应该可以实现
你也支持竖屏和横屏模式吗?
我和你做了同样的事情,在 AVD 中打开了“自动旋转屏幕”选项。效果非常好。