How To use landscape and reverseLandscape in AndroidManifest.xml

  Uncategorized

If you develope a app or activity which is only available in landscape mode, you can enhance the app by adding the reverseLandscape mode (Landscape orientation in the opposite direction from normal landscape. Added in API level 9.) via editing the android:screenOrientation attribute of your activity in AndroidManifest.xml. Instead of using the “landscape” value, you can use “sensorLandscape” (Landscape orientation, but can be either normal or reverse landscape based on the device sensor. Added in API level 9.).



This is a simple solution and your users will enjoy the possibility of using the device even if it is rotated by 180 degrees. The same solution is possible for portrait apps and activities. In this case you have to use sensorPortrait instead of sensorLandscape in AndroidManifest.xml.