Google is committed to advancing racial equity for Black communities. See how.

Insets

class Insets
kotlin.Any
   ↳ androidx.core.graphics.Insets

An Insets instance holds four integer offsets which describe changes to the four edges of a Rectangle. By convention, positive values move edges towards the centre of the rectangle.

Insets are immutable so may be treated as values.

Summary

Public methods
static Insets
add(@NonNull a: Insets, @NonNull b: Insets)

Add two Insets.

Boolean
equals(other: Any?)

Two Insets instances are equal if they belong to the same class and their fields are pairwise equal.

Int

static Insets
max(@NonNull a: Insets, @NonNull b: Insets)

Retrieves the maximum of two Insets.

static Insets
min(@NonNull a: Insets, @NonNull b: Insets)

Retrieves the minimum of two Insets.

static Insets
of(left: Int, top: Int, right: Int, bottom: Int)

Return an Insets instance with the appropriate values.

static Insets
of(@NonNull r: Rect)

Return an Insets instance with the appropriate values.

static Insets
subtract(@NonNull a: Insets, @NonNull b: Insets)

Subtract two Insets.

static Insets
toCompatInsets(@NonNull insets: Insets)

Return a copy of the given android.graphics.Insets instance, converted to be an Insets instance from AndroidX.

Insets

Return a copy this instance, converted to be an android.graphics.Insets instance from the platform.

String

Properties
static Insets

Int

Int

Int

Int

Public methods

add

@NonNull static fun add(
    @NonNull a: Insets,
    @NonNull b: Insets
): Insets

Add two Insets.

Parameters
a Insets: The first Insets to add.
b Insets: The second Insets to add.
Return
Insets a + b, i. e. all insets on every side are added together.

equals

fun equals(other: Any?): Boolean

Two Insets instances are equal if they belong to the same class and their fields are pairwise equal.

Parameters
o the object to compare this instance with.
Return
Boolean true iff this object is equal o

hashCode

fun hashCode(): Int

max

@NonNull static fun max(
    @NonNull a: Insets,
    @NonNull b: Insets
): Insets

Retrieves the maximum of two Insets.

Parameters
a Insets: The first Insets.
b Insets: The second Insets.
Return
Insets max(a, b), i. e. the larger of every inset on every side is taken for the result.

min

@NonNull static fun min(
    @NonNull a: Insets,
    @NonNull b: Insets
): Insets

Retrieves the minimum of two Insets.

Parameters
a Insets: The first Insets.
b Insets: The second Insets.
Return
Insets min(a, b), i. e. the smaller of every inset on every side is taken for the result.

of

@NonNull static fun of(
    left: Int,
    top: Int,
    right: Int,
    bottom: Int
): Insets

Return an Insets instance with the appropriate values.

Parameters
left Int: the left inset
top Int: the top inset
right Int: the right inset
bottom Int: the bottom inset
Return
Insets Insets instance with the appropriate values

of

@NonNull static fun of(@NonNull r: Rect): Insets

Return an Insets instance with the appropriate values.

Parameters
r Rect: the rectangle from which to take the values
Return
Insets an Insets instance with the appropriate values

subtract

@NonNull static fun subtract(
    @NonNull a: Insets,
    @NonNull b: Insets
): Insets

Subtract two Insets.

Parameters
a Insets: The minuend; the value from which b will be subtracted.
b Insets: The subtrahend; the value which will be subtracted from a.
Return
Insets a - b, i. e. all insets on every side are subtracted from each other.

toCompatInsets

@RequiresApi(29) @NonNull static fun toCompatInsets(@NonNull insets: Insets): Insets

Return a copy of the given android.graphics.Insets instance, converted to be an Insets instance from AndroidX.

toPlatformInsets

@RequiresApi(29) @NonNull fun toPlatformInsets(): Insets

Return a copy this instance, converted to be an android.graphics.Insets instance from the platform.

toString

fun toString(): String

Properties

NONE

@NonNull static val NONE: Insets

bottom

val bottom: Int

left

val left: Int
val right: Int

top

val top: Int