Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android App Landscape Only

I want to make my App landscape only, so I am using the method provided here: i want to make my application only in landscape in android

In short, I am adding android:screenOrientation="landscape" to my manifest file.

It is partially working, but the problem is that it only allows the user to use the app in one of the two landscape orientations. How can I tell the app that it is allowed to use either of the landscape orientations?

(testing on Nexus 7 4.2)

like image 690
MikeS Avatar asked Dec 15 '22 16:12

MikeS


2 Answers

Use android:screenOrientation="sensorLandscape" but it will work only if you are building your project on Android 2.3 or above.

like image 72
Androider Avatar answered Jan 05 '23 16:01

Androider


android:screenOrientation has several options you can find in the documentation

What you probably want is

  • "sensorLandscape"
    Landscape orientation, but can be either normal or reverse landscape based on the device sensor. Added in API level 9.
like image 34
zapl Avatar answered Jan 05 '23 16:01

zapl