简体   繁体   English

Android模拟器 - 屏幕旋转

[英]Android emulator - Screen rotation

I would like to test the rotation of a phone on the emulator, I see everywhere that we have to use Ctrl + F11 but it only rotates the image of the emulator and does not launch a configuration change event or redraw the activity. 我想在模拟器上测试手机的旋转,我看到无处不在,我们必须使用Ctrl + F11,但它只旋转模拟器的图像,不会启动配置更改事件或重绘活动。

Here is what I have with Ctrl + F11 : 这是我使用Ctrl + F11的内容

模拟器旋转

So, what do I have to use to simulate a real rotation ? 那么,我必须使用什么来模拟真正的旋转?

Also you can do: 你也可以这样做:

disable accelerometer controlling rotation - just do this once 禁用加速度计控制旋转 - 只需执行一次

adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0

rotate landscape: 旋转景观:

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1

rotate portrait: 旋转肖像:

adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0

rotate upside down landscape: 旋转倒置景观:

adb shell content insert --uri content://settings/system  --bind name:s:user_rotation --bind value:i:3

rotate upside down portrait: 旋转颠倒肖像:

adb shell content insert --uri content://settings/system  --bind name:s:user_rotation --bind value:i:2

If you have WRITE_SETTINGS permission you can write thru the content provider in java code as well. 如果您具有WRITE_SETTINGS权限,则还可以通过Java代码中的内容提供程序进行编写。

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

did you also support portrait and landscape mode 你也支持肖像和风景模式吗?

As suggested by Nicolas Jafelle here , you can try to add the property "Keyboard Support-->yes" in the emulator settings. 正如萨科Jafelle建议在这里 ,你可以尝试添加属性“键盘支持- >是”在仿真器设置。 That helped me. 这对我有所帮助。

PS: it will also allow for your emulator to get input from your keyboard. PS:它还允许你的模拟器从键盘输入。 See more here 在这里查看更多

this just doesn't work in 2.3 emulators, if that's what ur using 这只是在2.3模拟器中不起作用,如果这是你使用的

see here: 看这里:

Android - Emulator in landscape mode, screen does not rotate Android - 横向模式下的模拟器,屏幕不旋转

I did the same thing as you and turned the "auto-rotate screen" option on in the AVD. 我做了同样的事情并在AVD中打开了“自动旋转屏幕”选项。 Worked like a charm. 工作就像一个魅力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM