Most visited

Recently visited

GravityCompat

public final class GravityCompat
extends Object

java.lang.Object
   ↳ android.support.v4.view.GravityCompat


Gravity访问新功能的兼容填充。

Summary

Constants

int END

将对象推送到其容器末端的x轴位置,而不是更改其大小。

int RELATIVE_HORIZONTAL_GRAVITY_MASK

二进制掩码为水平引力和脚本特定的方向位。

int RELATIVE_LAYOUT_DIRECTION

原始位控制布局方向是否相对(开始/结束,而不是绝对的左/右)。

int START

将对象推送到其容器开始处的x轴位置,而不是更改其大小。

Public methods

static void apply(int gravity, int w, int h, Rect container, Rect outRect, int layoutDirection)

将重力常数应用于对象,并注意布局方向是否为RTL。

static void apply(int gravity, int w, int h, Rect container, int xAdj, int yAdj, Rect outRect, int layoutDirection)

将重力常数应用于对象。

static void applyDisplay(int gravity, Rect display, Rect inoutObj, int layoutDirection)

根据对象所在的整个“显示”应用额外的重力行为。

static int getAbsoluteGravity(int gravity, int layoutDirection)

将脚本比重转换为绝对水平值。

Inherited methods

From class java.lang.Object

Constants

END

int END

将对象推送到其容器末端的x轴位置,而不是更改其大小。

常量值:8388613(0x00800005)

RELATIVE_HORIZONTAL_GRAVITY_MASK

int RELATIVE_HORIZONTAL_GRAVITY_MASK

二进制掩码为水平引力和脚本特定的方向位。

常量值:8388615(0x00800007)

RELATIVE_LAYOUT_DIRECTION

int RELATIVE_LAYOUT_DIRECTION

原始位控制布局方向是否相对(开始/结束,而不是绝对的左/右)。

常量值:8388608(0x00800000)

START

int START

将对象推送到其容器开始处的x轴位置,而不是更改其大小。

常量值:8388611(0x00800003)

Public methods

apply

void apply (int gravity, 
                int w, 
                int h, 
                Rect container, 
                Rect outRect, 
                int layoutDirection)

将重力常数应用于对象,并注意布局方向是否为RTL。

Parameters
gravity int: The desired placement of the object, as defined by the constants in this class.
w int: The horizontal size of the object.
h int: The vertical size of the object.
container Rect: The frame of the containing space, in which the object will be placed. Should be large enough to contain the width and height of the object.
outRect Rect: Receives the computed frame of the object in its container.
layoutDirection int: The layout direction.

也可以看看:

apply

void apply (int gravity, 
                int w, 
                int h, 
                Rect container, 
                int xAdj, 
                int yAdj, 
                Rect outRect, 
                int layoutDirection)

将重力常数应用于对象。

Parameters
gravity int: The desired placement of the object, as defined by the constants in this class.
w int: The horizontal size of the object.
h int: The vertical size of the object.
container Rect: The frame of the containing space, in which the object will be placed. Should be large enough to contain the width and height of the object.
xAdj int: Offset to apply to the X axis. If gravity is LEFT this pushes it to the right; if gravity is RIGHT it pushes it to the left; if gravity is CENTER_HORIZONTAL it pushes it to the right or left; otherwise it is ignored.
yAdj int: Offset to apply to the Y axis. If gravity is TOP this pushes it down; if gravity is BOTTOM it pushes it up; if gravity is CENTER_VERTICAL it pushes it down or up; otherwise it is ignored.
outRect Rect: Receives the computed frame of the object in its container.
layoutDirection int: The layout direction.

也可以看看:

applyDisplay

void applyDisplay (int gravity, 
                Rect display, 
                Rect inoutObj, 
                int layoutDirection)

根据对象所在的整个“显示”应用额外的重力行为。这可以在apply(int, int, int, Rect, int, int, Rect)之后使用,以将对象放置在可见的显示内。 默认情况下,这会移动或剪切对象使其在显示中可见; 重力标志DISPLAY_CLIP_HORIZONTALDISPLAY_CLIP_VERTICAL可以用来改变这种行为。

Parameters
gravity int: Gravity constants to modify the placement within the display.
display Rect: The rectangle of the display in which the object is being placed.
inoutObj Rect: Supplies the current object position; returns with it modified if needed to fit in the display.
layoutDirection int: The layout direction.

也可以看看:

getAbsoluteGravity

int getAbsoluteGravity (int gravity, 
                int layoutDirection)

将脚本比重转换为绝对水平值。

if horizontal direction is LTR, then START will set LEFT and END will set RIGHT. if horizontal direction is RTL, then START will set RIGHT and END will set LEFT.

Parameters
gravity int: The gravity to convert to absolute (horizontal) values.
layoutDirection int: The layout direction.
Returns
int gravity converted to absolute (horizontal) values.

Hooray!