The second Android 11 Developer Preview is now available, test it out and share your feedback.

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

Boolean
equals(other: Any?)

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

Int

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
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

equals

fun equals(other: Any?): Boolean

Two Insets instances are equal iff 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

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

toCompatInsets

@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

@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

right

val right: Int

top

val top: Int