旋转 Android 显示而不改变方向

Rotate Android display without changing orientation

基本上我想要完成的是在侧面(垂直方向)放置一个矩形显示器,Android 显示在纵向位置。由于显示器的限制,在显示器本身上旋转显示是不可行的。首先我设置禁用自动旋转,然后将其设置为纵向模式。

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:0

然后我尝试使用以下命令将分辨率更改为 1920x1080

adb shell wm size 1920x1080

然后这会将显示恢复为横向模式。我更愿意通过 adb 或任何不需要额外软件的方法来完成这个。

编辑:

澄清一下,我想在 Windows 计算机上模拟 CTRL+ALT+RIGHT ARROW,但在 android 设备上最好通过 ADB 或除第 3 方应用程序之外的任何其他方法。

没有必要使用wm size除非你想crop/scale/etc。只需 settings put system user_rotation 1settings put system user_rotation 3

经过更多挖掘,我找到了相关答案。

其中一些可能不需要,但这是我为达到预期效果所做的。还有一个小故障,其中 Android 不会更新旋转,因此在重新启动后您必须将旋转更改为其他内容,然后再恢复为原始旋转。

adb shell root
adb shell remount
adb shell setprop persist.demo.hdmirotation portrait
adb shell setprop persist.demo.hdmirotationlock false
adb shell setprop persist.demo.singledisplay true
adb reboot
adb shell wm size 1080x1920
adb shell wm size 1920x1920

已找到答案 here, and the relevant documentation was found here