Insets

Added in 1.2.0

class 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

Constants

const Insets

Public functions

java-static Insets
add(a: Insets, b: Insets)

Add two Insets.

Boolean
equals(o: Any!)

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

Int
java-static Insets
max(a: Insets, b: Insets)

Returns the component-wise maximum of two Insets.

java-static Insets
min(a: Insets, b: Insets)

Returns the component-wise minimum of two Insets.

java-static Insets
of(r: Rect)

Return an Insets instance with the appropriate values.

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

Return an Insets instance with the appropriate values.

java-static Insets

Subtract two Insets.

java-static Insets
@RequiresApi(api = 29)
toCompatInsets(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

Public properties

Int
Int
Int
Int

Constants

NONE

Added in 1.2.0
const val NONEInsets

Public functions

add

Added in 1.5.0
java-static fun add(a: Insets, b: Insets): Insets

Add two Insets.

Parameters
a: Insets

The first Insets to add.

b: Insets

The second Insets to add.

Returns
Insets

a + b, i. e. all insets on every side are added together.

equals

fun equals(o: Any!): Boolean

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

Parameters
o: Any!

the object to compare this instance with.

Returns
Boolean

true iff this object is equal o

hashCode

fun hashCode(): Int

max

Added in 1.5.0
java-static fun max(a: Insets, b: Insets): Insets

Returns the component-wise maximum of two Insets.

Parameters
a: Insets

The first Insets.

b: Insets

The second Insets.

Returns
Insets

an Insets instance where the inset on each side is the larger of the insets on that side from a and b.

min

Added in 1.5.0
java-static fun min(a: Insets, b: Insets): Insets

Returns the component-wise minimum of two Insets.

Parameters
a: Insets

The first Insets.

b: Insets

The second Insets.

Returns
Insets

an Insets instance where the inset on each side is the smaller of the insets on that side from a and b.

of

Added in 1.2.0
java-static fun of(r: Rect): Insets

Return an Insets instance with the appropriate values.

Parameters
r: Rect

the rectangle from which to take the values

Returns
Insets

an Insets instance with the appropriate values

of

Added in 1.2.0
java-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

Returns
Insets

Insets instance with the appropriate values

subtract

Added in 1.5.0
java-static fun subtract(a: Insets, 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.

Returns
Insets

a - b, i. e. all insets on every side are subtracted from each other.

toCompatInsets

Added in 1.3.0
@RequiresApi(api = 29)
java-static fun toCompatInsets(insets: Insets): Insets

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

toPlatformInsets

Added in 1.3.0
@RequiresApi(value = 29)
fun toPlatformInsets(): Insets

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

toString

fun toString(): String

Public properties

bottom

Added in 1.2.0
val bottomInt

left

Added in 1.2.0
val leftInt

right

Added in 1.2.0
val rightInt

top

Added in 1.2.0
val topInt