pub enum ScreenOrientation {
Show 16 variants Unspecified, Behind, Landscape, Portrait, ReverseLandscape, ReversePortrait, SensorLandscape, SensorPortrait, UserLandscape, UserPortrait, Sensor, FullSensor, Nosensor, User, FullUser, Locked,
}
Expand description

The orientation of the activity’s display on the device.

Variants§

§

Unspecified

The default value. The system chooses the orientation. The policy it uses, and therefore the choices made in specific contexts, may differ from device to device.

§

Behind

The same orientation as the activity that’s immediately beneath it in the activity stack.

§

Landscape

Landscape orientation (the display is wider than it is tall).

§

Portrait

Portrait orientation (the display is taller than it is wide).

§

ReverseLandscape

Landscape orientation in the opposite direction from normal landscape.

Added in API level 9.

§

ReversePortrait

Portrait orientation in the opposite direction from normal portrait.

Added in API level 9.

§

SensorLandscape

Landscape orientation, but can be either normal or reverse landscape based on the device sensor. The sensor is used even if the user has locked sensor-based rotation.

Added in API level 9.

§

SensorPortrait

Portrait orientation, but can be either normal or reverse portrait based on the device sensor. The sensor is used even if the user has locked sensor-based rotation.

Added in API level 9.

§

UserLandscape

Landscape orientation, but can be either normal or reverse landscape based on the device sensor and the user’s preference.

Added in API level 18.

§

UserPortrait

Portrait orientation, but can be either normal or reverse portrait based on the device sensor and the user’s preference.

Added in API level 18.

§

Sensor

The orientation is determined by the device orientation sensor. The orientation of the display depends on how the user is holding the device; it changes when the user rotates the device. Some devices, though, will not rotate to all four possible orientations, by default. To allow all four orientations, use “fullSensor” The sensor is used even if the user locked sensor-based rotation.

§

FullSensor

The orientation is determined by the device orientation sensor for any of the 4 orientations. This is similar to “sensor” except this allows any of the 4 possible screen orientations, regardless of what the device will normally do (for example, some devices won’t normally use reverse portrait or reverse landscape, but this enables those).

Added in API level 9.

§

Nosensor

The orientation is determined without reference to a physical orientation sensor. The sensor is ignored, so the display will not rotate based on how the user moves the device.

§

User

The user’s current preferred orientation.

§

FullUser

If the user has locked sensor-based rotation, this behaves the same as user, otherwise it behaves the same as fullSensor and allows any of the 4 possible screen orientations.

Added in API level 18.

§

Locked

Locks the orientation to its current rotation, whatever that is.

Added in API level 18.

Trait Implementations§

source§

impl Clone for ScreenOrientation

source§

fn clone(&self) -> ScreenOrientation

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ScreenOrientation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ScreenOrientation

source§

fn default() -> ScreenOrientation

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for ScreenOrientation

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<ScreenOrientation> for ScreenOrientation

source§

fn eq(&self, other: &ScreenOrientation) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ScreenOrientation

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl YaDeserialize for ScreenOrientation

source§

fn deserialize<R: Read>(reader: &mut Deserializer<R>) -> Result<Self, String>

source§

impl YaSerialize for ScreenOrientation

source§

fn serialize<W: Write>(&self, writer: &mut Serializer<W>) -> Result<(), String>

source§

fn serialize_attributes( &self, source_attributes: Vec<OwnedAttribute>, source_namespace: Namespace ) -> Result<(Vec<OwnedAttribute>, Namespace), String>

source§

impl Eq for ScreenOrientation

source§

impl StructuralEq for ScreenOrientation

source§

impl StructuralPartialEq for ScreenOrientation

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,