Raspberry Pi 3 的屏幕方向有 Android 个东西
Screen orientation on Raspberry Pi 3 with Android things
我刚买了一个 Raspberry Pi 3,带有 7" 显示屏触摸屏和外壳。
不幸的是,外壳不允许我手动旋转屏幕,所以我的应用程序 运行 颠倒了。
我尝试使用以下 adb 命令从控制台执行此操作,但没有成功:
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:3
有没有什么方法可以直接从配置标志中做到这一点,屏幕方向是从启动时处理的?
我终于知道怎么实现了。
在那里找到了解决方案:
您必须从笔记本电脑上的 sdcard 挂载引导分区并编辑 /boot/config.txt
文件并添加以下行:
lcd_rotate=2
通过添加此行,显示屏和触摸屏都会旋转,相比之下 display_rotate=2
只有显示屏旋转而触摸屏保持倒置。
Google 在 DP6 中添加了新的 API 来控制设备设置,包括显示方向:Android Things uses three different APIs to control settings 用于 屏幕(显示)、系统时间,以及可用的语言环境。
如果这些 API 的行为不符合您的预期,请open a new bug。
试试这个:
if (Build.DEVICE.equalsIgnoreCase("rpi3"))
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
步骤 1
在 rpi 上,打开终端并 运行 以下内容:
sudo nano /boot/config.txt
步骤 2
滚动到文件底部并添加:
display_lcd_rotate=2
现在,要保存,请按 Ctrl+x,然后按 'y',然后按 return。
步骤 3
现在运行
sudo reboot
完成!
注意,如果你想旋转 90º,而不是 180º(纵向),你需要在 config.txt 中添加以下两行:
display_lcd_rotate=1
dtoverlay=rpi-ft5406,touchscreen-swapped-x-y=1,touchscreen-inverted-x=1
我刚买了一个 Raspberry Pi 3,带有 7" 显示屏触摸屏和外壳。
不幸的是,外壳不允许我手动旋转屏幕,所以我的应用程序 运行 颠倒了。
我尝试使用以下 adb 命令从控制台执行此操作,但没有成功:
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:3
有没有什么方法可以直接从配置标志中做到这一点,屏幕方向是从启动时处理的?
我终于知道怎么实现了。
在那里找到了解决方案:
您必须从笔记本电脑上的 sdcard 挂载引导分区并编辑 /boot/config.txt
文件并添加以下行:
lcd_rotate=2
通过添加此行,显示屏和触摸屏都会旋转,相比之下 display_rotate=2
只有显示屏旋转而触摸屏保持倒置。
Google 在 DP6 中添加了新的 API 来控制设备设置,包括显示方向:Android Things uses three different APIs to control settings 用于 屏幕(显示)、系统时间,以及可用的语言环境。
如果这些 API 的行为不符合您的预期,请open a new bug。
试试这个:
if (Build.DEVICE.equalsIgnoreCase("rpi3"))
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
步骤 1
在 rpi 上,打开终端并 运行 以下内容:
sudo nano /boot/config.txt
步骤 2
滚动到文件底部并添加:
display_lcd_rotate=2
现在,要保存,请按 Ctrl+x,然后按 'y',然后按 return。
步骤 3
现在运行
sudo reboot
完成!
注意,如果你想旋转 90º,而不是 180º(纵向),你需要在 config.txt 中添加以下两行:
display_lcd_rotate=1
dtoverlay=rpi-ft5406,touchscreen-swapped-x-y=1,touchscreen-inverted-x=1