Android模拟器 - 屏幕旋转

Ste*_*his 17 android screen emulation rotation android-emulator

我想在模拟器上测试手机的旋转,我看到我们必须使用的所有地方Ctrl+F11但它只旋转模拟器的图像并且不会启动配置更改事件或重绘活动.

这是我用的Ctrl+F11:

模拟器旋转

那么,我必须使用什么来模拟真正的旋转?

小智 48

你也可以这样做:

禁用加速度计控制旋转 - 只需执行一次

adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
Run Code Online (Sandbox Code Playgroud)

旋转景观:

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
Run Code Online (Sandbox Code Playgroud)

旋转肖像:

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0
Run Code Online (Sandbox Code Playgroud)

旋转倒置景观:

adb shell content insert --uri content://settings/system  --bind name:s:user_rotation --bind value:i:3
Run Code Online (Sandbox Code Playgroud)

旋转颠倒肖像:

adb shell content insert --uri content://settings/system  --bind name:s:user_rotation --bind value:i:2
Run Code Online (Sandbox Code Playgroud)

如果您具有WRITE_SETTINGS权限,则还可以通过Java代码中的内容提供程序进行编写.

  • API 10仿真器上的`content:not found`错误 (2认同)

KPa*_*001 5

http://developer.android.com/tools/help/emulator.html这应该这样做

你也支持肖像和风景模式吗?

  • 您可以使用Ctrl + F12. (2认同)

Gra*_*tei 4

正如 Nicolas Jafelle在这里建议的,您可以尝试在模拟器设置中添加属性“键盘支持-->是”。这对我有帮助。

PS:它还允许您的模拟器从键盘获取输入。在这里查看更多内容

  • 因为这是 ADT 中的错误,如果没有这个硬件键盘技巧,它就无法工作。即使在刚刚发布的 ADT 21 中也是如此。请参阅:http://code.google.com/p/android/issues/detail?id=34237 (3认同)
  • 为什么这被标记为答案???问题是如何获得像真实手机上那样的“真实”旋转,而不是如何使用键盘。 (2认同)