GravityCompat
class GravityCompat
kotlin.Any | |
↳ | androidx.core.view.GravityCompat |
Compatibility shim for accessing newer functionality from android.view.Gravity
.
Summary
Constants | |
---|---|
static Int |
Push object to x-axis position at the end of its container, not changing its size. |
static Int |
Binary mask for the horizontal gravity and script specific direction bit. |
static Int |
Raw bit controlling whether the layout direction is relative or not (START/END instead of absolute LEFT/RIGHT). |
static Int |
Push object to x-axis position at the start of its container, not changing its size. |
Public methods | |
---|---|
static Unit |
Apply a gravity constant to an object and take care if layout direction is RTL or not. |
static Unit |
apply(gravity: Int, w: Int, h: Int, container: Rect!, xAdj: Int, yAdj: Int, outRect: Rect!, layoutDirection: Int) Apply a gravity constant to an object. |
static Unit |
applyDisplay(gravity: Int, display: Rect!, inoutObj: Rect!, layoutDirection: Int) Apply additional gravity behavior based on the overall "display" that an object exists in. |
static Int |
getAbsoluteGravity(gravity: Int, layoutDirection: Int) Convert script specific gravity to absolute horizontal value. |
Constants
END
static val END: Int
Push object to x-axis position at the end of its container, not changing its size.
Value: RELATIVE_LAYOUT_DIRECTION | Gravity.RIGHT
RELATIVE_HORIZONTAL_GRAVITY_MASK
static val RELATIVE_HORIZONTAL_GRAVITY_MASK: Int
Binary mask for the horizontal gravity and script specific direction bit.
Value: START | END
RELATIVE_LAYOUT_DIRECTION
static val RELATIVE_LAYOUT_DIRECTION: Int
Raw bit controlling whether the layout direction is relative or not (START/END instead of absolute LEFT/RIGHT).
Value: 0x00800000
START
static val START: Int
Push object to x-axis position at the start of its container, not changing its size.
Value: RELATIVE_LAYOUT_DIRECTION | Gravity.LEFT
Public methods
apply
static fun apply(
gravity: Int,
w: Int,
h: Int,
container: Rect!,
outRect: Rect!,
layoutDirection: Int
): Unit
Apply a gravity constant to an object and take care if layout direction is RTL or not.
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. |