droid_wrap::android::view

Struct ViewGroup_LayoutParams

Source
pub struct ViewGroup_LayoutParams { /* private fields */ }
Expand description

视图使用 LayoutParams 来告诉其父级它们希望如何布局。请参阅 ViewGroup 布局属性,了解此类支持的所有子视图属性的列表。 基本 LayoutParams 类仅描述视图希望的宽度和高度。对于每个维度,它可以指定以下之一: FILL_PARENT(在 API 级别 8 及更高版本中重命名为 MATCH_PARENT),这意味着视图希望与其父级一样大(减去填充) WRAP_CONTENT,这意味着视图希望足够大以包含其内容(加上填充)

一个确切的数字 对于不同的 ViewGroup 子类,有 LayoutParams 的子类。例如,AbsoluteLayout 有自己的 LayoutParams 子类,它添加了 X 和 Y 值。

开发人员指南 有关创建用户界面布局的更多信息,请阅读 XML 布局开发人员指南。

Implementations§

Source§

impl ViewGroup_LayoutParams

Source

pub const FILL_PARENT: i32 = -1i32

👎Deprecated: 从 API 级别 8 开始,此值已弃用,并由 MATCH_PARENT 取代。

视图请求的高度或宽度的特殊值。FILL_PARENT 表示视图希望与其父级一样大,减去父级的填充(如果有)。

Source

pub const MATCH_PARENT: i32 = -1i32

视图请求的高度或宽度的特殊值。MATCH_PARENT 表示视图希望与其父级一样大,减去父级的填充(如果有)。在 API 级别 8 中引入。

Source

pub const WRAP_CONTENT: i32 = -2i32

视图请求的高度或宽度的特殊值。WRAP_CONTENT 表示视图希望足够大以容纳其自己的内部内容,同时考虑其自己的填充。

Source

pub fn get_width(&self) -> i32

有关视图所需宽度的信息。可以是常量 FILL_PARENT(在 API 级别 8 中由 MATCH_PARENT 取代)或 WRAP_CONTENT 之一,也可以是确切的大小。

Source

pub fn set_width(&self, value: i32)

有关视图所需宽度的信息。可以是常量 FILL_PARENT(在 API 级别 8 中由 MATCH_PARENT 取代)或 WRAP_CONTENT 之一,也可以是确切的大小。

Source

pub fn get_height(&self) -> i32

有关视图所需高度的信息。可以是常量 FILL_PARENT(在 API 级别 8 中由 MATCH_PARENT 取代)或 WRAP_CONTENT 之一,也可以是确切的大小。

Source

pub fn set_height(&self, value: i32)

有关视图所需高度的信息。可以是常量 FILL_PARENT(在 API 级别 8 中由 MATCH_PARENT 取代)或 WRAP_CONTENT 之一,也可以是确切的大小。

Source

pub fn new(width: i32, height: i32) -> Self

创建一组具有指定宽度和高度的新布局参数。 width 宽度,可以是 WRAP_CONTENT、FILL_PARENT(在 API 级别 8 中由 MATCH_PARENT 替换),也可以是固定大小(以像素为单位) height 高度,可以是 WRAP_CONTENT、FILL_PARENT(在 API 级别 8 中由 MATCH_PARENT 替换),也可以是固定大小(以像素为单位)

Methods from Deref<Target = GlobalRef>§

Source

pub fn as_obj(&self) -> &JObject<'static>

Get the object from the global ref

This borrows the ref and prevents it from being dropped as long as the JObject sticks around.

Methods from Deref<Target = JObject<'static>>§

Source

pub fn as_raw(&self) -> *mut _jobject

Returns the raw JNI pointer.

Trait Implementations§

Source§

impl Debug for ViewGroup_LayoutParams

Source§

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

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

impl Deref for ViewGroup_LayoutParams

Source§

type Target = GlobalRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<&GlobalRef> for ViewGroup_LayoutParams

Source§

fn from(obj: &GlobalRef) -> Self

Converts to this type from the input type.
Source§

impl Into<GlobalRef> for &ViewGroup_LayoutParams

Source§

fn into(self) -> GlobalRef

Converts this type into the (usually inferred) input type.
Source§

impl JObjNew for ViewGroup_LayoutParams

Source§

type Fields = ()

字段类型
Source§

fn _new(this: &GlobalRef, fields: Self::Fields) -> Self

从java对象创建本地对象。 this java对象引用。
Source§

fn null() -> Self
where Self: Sized, Self::Fields: Default,

创建空对象。
Source§

impl JObjRef for ViewGroup_LayoutParams

Source§

fn java_ref(&self) -> GlobalRef

获取java对象引用。
Source§

impl JType for ViewGroup_LayoutParams

Source§

const CLASS: &'static str = "android/view/ViewGroup$LayoutParams"

java类的名称。
Source§

const OBJECT_SIG: &'static str = "Landroid/view/ViewGroup$LayoutParams;"

对象的签名描述。
Source§

type Error = Error

错误类型。
Source§

const DIM: u8 = 0u8

数组维度,0表示不是数组
Source§

impl PartialEq for ViewGroup_LayoutParams

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToString for ViewGroup_LayoutParams

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.