android: screenOrientation property (limit horizontal and vertical screen display)

The first day of practice, watching to see the older generation of code for a android:screenOrientationproperty, do not quite understand, by the degree of your mother after recording it is understood that the reference to the article is at the end.

android:screenOrientationAttribute can be placed AndroidManifest.xmla Activitytab for limiting the Activityhorizontal and vertical screen display mode when started, examples:

<activity
    android:screenOrientation="landscape"

    android:name=".activity.SplashActivity"
    android:theme="@style/SplashTheme">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

This attribute is used to set the orientation of the activity , have the following common 7optional values :

  • Unspecified - default display direction selected by the system, in different devices may vary.
  • Landscape - lateral
  • Portrait - longitudinal
  • the User - current preferred direction of the user
  • behind - and activities under the active stack in the same direction
  • Sensor - a direction sensor is determined according to the physical direction, depending on the direction of the user's hand, when the user rotates the device, he can arbitrarily changed.
  • nosensor - direction without physically determined direction sensor, the sensor is ignored, so that when the user rotates the device, the display does not follow the change, but not in addition to this, the system selects the same for Policy "unspecified" is set, the system in accordance with "Not specify "( unspecified) is set to select the same display direction.

Reference article : Android: screenOrientation property

Guess you like

Origin blog.csdn.net/weixin_33805557/article/details/90877650