Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep the screen in landscape mode in Android

Tags:

android

I have an activity which should always be displayed in Landscape mode. So i added android:screenOrientation="landscape".

But the problem is when I rotate the device by 180 degrees, the display is inverted. is there a way to handle this issue so that the screen elements are always shown correctly.?

like image 830
prashant Avatar asked Sep 10 '25 05:09

prashant


1 Answers

Actually what you really want is to specify:

android:screenOrientation="sensorLandscape"

in your AndroidManifest.xml. This will listen to the sensor data while snapping between landscape and reverseLandscape.

like image 96
CaseyB Avatar answered Sep 12 '25 18:09

CaseyB