I’m writing an application for an Android Tablet. I want the ScreenOrientation always to be in “Landscape”, but the app should be able to rotate 180°. If you hold the Tablet upside down, the View should be displayed correctly and rotate 180°.
Is there a simple way to do this? At the moment I’m forcing the app to be in landscape mode only within the Manifest I wrote android:screenOrientation="landscape" for the activity. But the rotation won’t work like that.
Use
android:screenOrientation="sensorLandscape"instead.See Dev Guide
Note that if you use
android:configChanges="orientation"to avoid screen rotation in the activity tag, the screen will not rotate at all. If you want it to rotate only in landscape, use the option described above and remove the orientation flag. Check what is the behaviour you want before using this option or not.