Recently in the Tablet project, you need to use the horizontal screen switch, now put the attributes to be easy to view later.
Usually our app will only be designed as a horizontal screen or vertical screen, the way to lock the horizontal screen or vertical screen is to set the attribute android:screenorientation "Landscape" or "portrait" in the Manifest.xml file:
<activity android:name="com.jooylife.jimei_tablet.base.Main" android:label="@string/app_name" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </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"]
Where Sensorlandscape is horizontal screen according to gravity switch, sensorportrait vertical screen according to Gravity switch.
Android Screen Toggle Properties