Android XML setting screen orientation (android:screenOrientation) detailed explanation
Note: Android only supports 270 degrees of rotation.
<activity android:name=".MyActivity" android:label="@string/app_name" android:screenOrientation="portrait">
android:screenOrientation sets the direction of the activity, and the value can be any of the following strings:
"unspecified"
- Default. The display direction is selected by the system. It may vary on different devices.
"landscape"
- Horizontal
"portrait"
- Vertical
"user"
- User's current preferred direction
"behind"
- Same direction as the activity under the activity stack
"sensor"
- Determine the direction according to the physical direction sensor. Depending on the direction the user is holding, it changes as the user rotates the device.
"nosensor"
- Direction is determined without the physical orientation sensor. The sensor is ignored, so when the user rotates the device, the display will not change as well. Apart from this difference, the system chooses to use the same policy orientation for the "Unspecified" setting. The system selects the same display orientation based on the "Unspecified" setting.
Thank you for reading, I hope it can help you. Thank you for your support for this site!