Udostępnij za pośrednictwem


Display.Rotation Property

Definition

Returns the rotation of the screen from its "natural" orientation.

public virtual Android.Views.SurfaceOrientation Rotation { [Android.Runtime.Register("getRotation", "()I", "GetGetRotationHandler")] get; }
[<get: Android.Runtime.Register("getRotation", "()I", "GetGetRotationHandler")>]
member this.Rotation : Android.Views.SurfaceOrientation

Property Value

Attributes

Remarks

Returns the rotation of the screen from its "natural" orientation. The returned value may be Surface#ROTATION_0 Surface.ROTATION_0 (no rotation), Surface#ROTATION_90 Surface.ROTATION_90, Surface#ROTATION_180 Surface.ROTATION_180, or Surface#ROTATION_270 Surface.ROTATION_270. For example, if a device has a naturally tall screen, and the user has turned it on its side to go into a landscape orientation, the value returned here may be either Surface#ROTATION_90 Surface.ROTATION_90 or Surface#ROTATION_270 Surface.ROTATION_270 depending on the direction it was turned. The angle is the rotation of the drawn graphics on the screen, which is the opposite direction of the physical rotation of the device. For example, if the device is rotated 90 degrees counter-clockwise, to compensate rendering will be rotated by 90 degrees clockwise and thus the returned value here will be Surface#ROTATION_90 Surface.ROTATION_90.

This rotation value will match the results of #getMetrics: this means that the rotation value will correspond to the activity if accessed through the activity.

Java documentation for android.view.Display.getRotation().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to