java.lang.Object | |
↳ | android.view.Gravity |
Standard constants and tools for placing an object within a potentially larger container.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | AXIS_CLIP | Raw bit controlling whether the right/bottom edge is clipped to its container, based on the gravity direction being applied. | |||||||||
int | AXIS_PULL_AFTER | Raw bit controlling how the right/bottom edge is placed. | |||||||||
int | AXIS_PULL_BEFORE | Raw bit controlling how the left/top edge is placed. | |||||||||
int | AXIS_SPECIFIED | Raw bit indicating the gravity for an axis has been specified. | |||||||||
int | AXIS_X_SHIFT | Bits defining the horizontal axis. | |||||||||
int | AXIS_Y_SHIFT | Bits defining the vertical axis. | |||||||||
int | BOTTOM | Push object to the bottom of its container, not changing its size. | |||||||||
int | CENTER | Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. | |||||||||
int | CENTER_HORIZONTAL | Place object in the horizontal center of its container, not changing its size. | |||||||||
int | CENTER_VERTICAL | Place object in the vertical center of its container, not changing its size. | |||||||||
int | CLIP_HORIZONTAL | Flag to clip the edges of the object to its container along the horizontal axis. | |||||||||
int | CLIP_VERTICAL | Flag to clip the edges of the object to its container along the vertical axis. | |||||||||
int | DISPLAY_CLIP_HORIZONTAL | Special constant to enable clipping to an overall display along the horizontal dimension. | |||||||||
int | DISPLAY_CLIP_VERTICAL | Special constant to enable clipping to an overall display along the vertical dimension. | |||||||||
int | END | Push object to x-axis position at the end of its container, not changing its size. | |||||||||
int | FILL | Grow the horizontal and vertical size of the object if needed so it completely fills its container. | |||||||||
int | FILL_HORIZONTAL | Grow the horizontal size of the object if needed so it completely fills its container. | |||||||||
int | FILL_VERTICAL | Grow the vertical size of the object if needed so it completely fills its container. | |||||||||
int | HORIZONTAL_GRAVITY_MASK | Binary mask to get the absolute horizontal gravity of a gravity. | |||||||||
int | LEFT | Push object to the left of its container, not changing its size. | |||||||||
int | NO_GRAVITY | Constant indicating that no gravity has been set | |||||||||
int | RELATIVE_HORIZONTAL_GRAVITY_MASK | Binary mask for the horizontal gravity and script specific direction bit. | |||||||||
int | RELATIVE_LAYOUT_DIRECTION | Raw bit controlling whether the layout direction is relative or not (START/END instead of absolute LEFT/RIGHT). | |||||||||
int | RIGHT | Push object to the right of its container, not changing its size. | |||||||||
int | START | Push object to x-axis position at the start of its container, not changing its size. | |||||||||
int | TOP | Push object to the top of its container, not changing its size. | |||||||||
int | VERTICAL_GRAVITY_MASK | Binary mask to get the vertical gravity of a gravity. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Apply a gravity constant to an object and take care if layout direction is RTL or not.
| |||||||||||
Apply a gravity constant to an object.
| |||||||||||
Apply a gravity constant to an object.
| |||||||||||
Apply a gravity constant to an object.
| |||||||||||
Apply additional gravity behavior based on the overall "display" that an
object exists in.
| |||||||||||
Apply additional gravity behavior based on the overall "display" that an
object exists in.
| |||||||||||
Convert script specific gravity to absolute horizontal value. | |||||||||||
Indicate whether the supplied gravity has an horizontal pull. | |||||||||||
Indicate whether the supplied gravity has a vertical pull. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Raw bit controlling whether the right/bottom edge is clipped to its container, based on the gravity direction being applied.
Raw bit controlling how the right/bottom edge is placed.
Raw bit controlling how the left/top edge is placed.
Raw bit indicating the gravity for an axis has been specified.
Bits defining the horizontal axis.
Bits defining the vertical axis.
Push object to the bottom of its container, not changing its size.
Place the object in the center of its container in both the vertical and horizontal axis, not changing its size.
Place object in the horizontal center of its container, not changing its size.
Place object in the vertical center of its container, not changing its size.
Flag to clip the edges of the object to its container along the horizontal axis.
Flag to clip the edges of the object to its container along the vertical axis.
Special constant to enable clipping to an overall display along the
horizontal dimension. This is not applied by default by
apply(int, int, int, Rect, int, int, Rect)
; you must do so
yourself by calling applyDisplay(int, Rect, Rect)
.
Special constant to enable clipping to an overall display along the
vertical dimension. This is not applied by default by
apply(int, int, int, Rect, int, int, Rect)
; you must do so
yourself by calling applyDisplay(int, Rect, Rect)
.
Push object to x-axis position at the end of its container, not changing its size.
Grow the horizontal and vertical size of the object if needed so it completely fills its container.
Grow the horizontal size of the object if needed so it completely fills its container.
Grow the vertical size of the object if needed so it completely fills its container.
Binary mask to get the absolute horizontal gravity of a gravity.
Push object to the left of its container, not changing its size.
Constant indicating that no gravity has been set
Binary mask for the horizontal gravity and script specific direction bit.
Raw bit controlling whether the layout direction is relative or not (START/END instead of absolute LEFT/RIGHT).
Push object to the right of its container, not changing its size.
Push object to x-axis position at the start of its container, not changing its size.
Push object to the top of its container, not changing its size.
Binary mask to get the vertical gravity of a gravity.
Apply a gravity constant to an object and take care if layout direction is RTL or not.
gravity | The desired placement of the object, as defined by the constants in this class. |
---|---|
w | The horizontal size of the object. |
h | The vertical size of the object. |
container | 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 | Receives the computed frame of the object in its container. |
layoutDirection | The layout direction. |
Apply a gravity constant to an object.
gravity | The desired placement of the object, as defined by the constants in this class. |
---|---|
w | The horizontal size of the object. |
h | The vertical size of the object. |
container | 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 | 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 | 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 | Receives the computed frame of the object in its container. |
Apply a gravity constant to an object. This supposes that the layout direction is LTR.
gravity | The desired placement of the object, as defined by the constants in this class. |
---|---|
w | The horizontal size of the object. |
h | The vertical size of the object. |
container | 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 | Receives the computed frame of the object in its container. |
Apply a gravity constant to an object.
gravity | The desired placement of the object, as defined by the constants in this class. |
---|---|
w | The horizontal size of the object. |
h | The vertical size of the object. |
container | 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 | 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 | 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 | Receives the computed frame of the object in its container. |
layoutDirection | The layout direction. |
Apply additional gravity behavior based on the overall "display" that an
object exists in. This can be used after
apply(int, int, int, Rect, int, int, Rect)
to place the object
within a visible display. By default this moves or clips the object
to be visible in the display; the gravity flags
DISPLAY_CLIP_HORIZONTAL
and DISPLAY_CLIP_VERTICAL
can be used to change this behavior.
gravity | Gravity constants to modify the placement within the display. |
---|---|
display | The rectangle of the display in which the object is being placed. |
inoutObj | Supplies the current object position; returns with it modified if needed to fit in the display. |
Apply additional gravity behavior based on the overall "display" that an
object exists in. This can be used after
apply(int, int, int, Rect, int, int, Rect)
to place the object
within a visible display. By default this moves or clips the object
to be visible in the display; the gravity flags
DISPLAY_CLIP_HORIZONTAL
and DISPLAY_CLIP_VERTICAL
can be used to change this behavior.
gravity | Gravity constants to modify the placement within the display. |
---|---|
display | The rectangle of the display in which the object is being placed. |
inoutObj | Supplies the current object position; returns with it modified if needed to fit in the display. |
layoutDirection | The layout direction. |
Convert script specific gravity to absolute horizontal value.
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.gravity | The gravity to convert to absolute (horizontal) values. |
---|---|
layoutDirection | The layout direction. |
Indicate whether the supplied gravity has an horizontal pull.
gravity | the gravity to check for horizontal pull |
---|
Indicate whether the supplied gravity has a vertical pull.
gravity | the gravity to check for vertical pull |
---|