-
public final 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.
-
-
Method Summary
Modifier and Type Method Description static Insets
of(int left, int top, int right, int bottom)
Return an Insets instance with the appropriate values. static Insets
of(@NonNull() Rect r)
Return an Insets instance with the appropriate values. static Insets
add(@NonNull() Insets a, @NonNull() Insets b)
Add two Insets. static Insets
subtract(@NonNull() Insets a, @NonNull() Insets b)
Subtract two Insets. static Insets
max(@NonNull() Insets a, @NonNull() Insets b)
Retrieves the maximum of two Insets. static Insets
min(@NonNull() Insets a, @NonNull() Insets b)
Retrieves the minimum of two Insets. boolean
equals(Object o)
Two Insets instances are equal if they belong to the same class and their fields arepairwise equal. int
hashCode()
String
toString()
static Insets
wrap(@NonNull() Insets 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
toPlatformInsets()
Return a copy this instance, converted to be an android.graphics.Insets instancefrom the platform. -
-
Method Detail
-
of
@NonNull() static Insets of(int left, int top, int right, int bottom)
Return an Insets instance with the appropriate values.
- Parameters:
left
- the left insettop
- the top insetright
- the right insetbottom
- the bottom inset
-
of
@NonNull() static Insets of(@NonNull() Rect r)
Return an Insets instance with the appropriate values.
- Parameters:
r
- the rectangle from which to take the values
-
add
@NonNull() static Insets add(@NonNull() Insets a, @NonNull() Insets b)
Add two Insets.
- Parameters:
a
- The first Insets to add.b
- The second Insets to add.
-
subtract
@NonNull() static Insets subtract(@NonNull() Insets a, @NonNull() Insets b)
Subtract two Insets.
- Parameters:
a
- The minuend; the value from which{@code b}
will be subtracted.b
- The subtrahend; the value which will be subtracted from{@code a}
.
-
max
@NonNull() static Insets max(@NonNull() Insets a, @NonNull() Insets b)
Retrieves the maximum of two Insets.
- Parameters:
a
- The first Insets.b
- The second Insets.
-
min
@NonNull() static Insets min(@NonNull() Insets a, @NonNull() Insets b)
Retrieves the minimum of two Insets.
- Parameters:
a
- The first Insets.b
- The second Insets.
-
equals
boolean equals(Object o)
Two Insets instances are equal if they belong to the same class and their fields arepairwise equal.
- Parameters:
o
- the object to compare this instance with.
-
hashCode
int hashCode()
-
toCompatInsets
@NonNull() static Insets toCompatInsets(@NonNull() Insets insets)
Return a copy of the given android.graphics.Insets instance, converted to be an Insets instance from AndroidX.
-
toPlatformInsets
@NonNull() Insets toPlatformInsets()
Return a copy this instance, converted to be an android.graphics.Insets instancefrom the platform.
-
-
-
-