Screen orientation on Raspberry Pi 3 with Android things

风流意气都作罢 提交于 2019-12-17 18:56:09

问题


I've just bought a Raspberry Pi 3 with a 7" Display touch screen and a casing.

Unfortunately, the casing can't allow me to rotate manually the screen so my apps are running upside down.

I've tried to do it from the console using the following adb commands but with no luck:

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

Then

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

Or

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

Is there any way to do it from a config flag directly that screen orientation is handled from boot ?


回答1:


I find out finally how to achieve it.

Solution found there : Android Things with Rasp3 7 inch touchscreen

You have to mount the boot partition from the sdcard on your laptop and edit the /boot/config.txt file and add the following line:

lcd_rotate=2

By adding this line both display and touchscreen will be rotated, compared to display_rotate=2 where only display is rotated and touchscreen remains upside down.




回答2:


Google added new APIs in DP6 to control device settings, including display orientation: Android Things uses three different APIs to control settings for the screen (display), system time, and available locales.

Please open a new bug if these APIs do not behave as you expect.




回答3:


Try this:

if (Build.DEVICE.equalsIgnoreCase("rpi3"))
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);


来源:https://stackoverflow.com/questions/41558508/screen-orientation-on-raspberry-pi-3-with-android-things

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!