4

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)

Community
  • 1
  • 1
MikeS
  • 3,891
  • 6
  • 35
  • 51

3 Answers3

10

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

Androider
  • 2,884
  • 5
  • 28
  • 47
  • Thanks, this is just what I needed! Does "landscape" only give one orientation because some Android devices have physical keyboards which means they really only have one proper landscape orientation? – MikeS Nov 28 '12 at 18:28
  • There was no concept of reverse-Landscape until Android 2.3 This feature was introduced in Android 2.3 and yes it is better to use "landscape" for devices having physical keyboard but it is entirely up to developer's requirement – Androider Nov 28 '12 at 18:38
1

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.
zapl
  • 63,179
  • 10
  • 123
  • 154
1

There is also "userLandscape" - as per documentation

Landscape orientation, but can be either normal or reverse landscape based on the device sensor and the user's sensor preference. If the user has locked sensor-based rotation, this behaves the same as landscape, otherwise it behaves the same as sensorLandscape. Added in API level 18.

Ryan Heitner
  • 13,119
  • 6
  • 77
  • 119