How to lock application orientation to landscape properly on Surface Duo

Copper Contributor

Hi, we are developing a game that have landscape UI only. We tried locking orientation by adding

 

 

android:screenOrientation="sensorLandscape"

 

 

to the AndroidManifest.xml and calling

 

 

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE);

 

 

in the activity. But the result looked like this (the left screen):
Locked landscapeLocked landscape

The content look weird and become smaller. We also notice many games have the same issue.

Do  you guys know how to solve this.

Thank you for your help.

1 Reply

@tungnt this behavior is by-design. As shown in your screenshot, the app on the other screen is in portrait mode, and we do not want the customer to see one app display 90 degrees rotated from the other. 

 

If you rotate the device sideways, the orientation-locked app will take the whole landscape-oriented screen (and the other will either adapt to landscape, or be shown in portrait with black bars on the side).

 

If you spanned the orientation-locked app across both screens, it will then appear landscape-orientation-locked and take up the whole two screens.

 

Hope that makes sense?