android set horizontal screen code

The default orientation can be set in the .xml file , and the android:screenOrientation attribute value in the activity is set in AndroidManifest.xml
The android:screenOrientation attribute has the following parameters:
"landscape": landscape display (width is longer than height)
"portrait": vertical screen display (height longer than width)
For example the following settings
android:screenOrientation="portrait"
No matter how the phone changes, the activity with this property will be displayed vertically.
android:screenOrientation="landscape", for landscape display.
The above modification can also be set in Java code by code similar to the following
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327092556&siteId=291194637