SoFunction
Updated on 2025-04-04

Android screen flips up and down

Android screen flips up and down

Usually our application will only be designed as a horizontal or vertical screen. The way to lock the horizontal or vertical screen is to set the attribute android:screenOrientation to "landscape" or "portrait" in the file:

 <activity
      android:name="."
      android:label="@string/app_name" 
      android:screenOrientation="landscape">
      <intent-filter>
        <action android:name="" />
        <category android:name="" />
      </intent-filter>
    </activity>

In fact, screenOrientation can also be set to many values:

android:screenOrientation    =     ["unspecified" | "behind" |
                   "landscape" | "portrait" |
                   "reverseLandscape" | "reversePortrait" |
                   "sensorLandscape" | "sensorPortrait" |
                   "userLandscape" | "userPortrait" |
                   "sensor" | "fullSensor" | "nosensor" |
                   "user" | "fullUser" | "locked"]

Among them, sensorLandscape is the horizontal screen flip up and down according to gravity, and sensorPortrait vertical screen flip up and down according to gravity.

If you are interested, you can also try other values...

Thank you for reading, I hope it can help you. Thank you for your support for this site!