Insets
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.
Summary
Public methods |
|
|---|---|
static @NonNull Insets |
Add two Insets. |
boolean |
Two Insets instances are equal if they belong to the same class and their fields are pairwise equal. |
int |
hashCode() |
static @NonNull Insets |
Returns the component-wise maximum of two Insets. |
static @NonNull Insets |
Returns the component-wise minimum of two Insets. |
static @NonNull Insets |
Return an Insets instance with the appropriate values. |
static @NonNull Insets |
of(int left, int top, int right, int bottom)Return an Insets instance with the appropriate values. |
static @NonNull Insets |
Subtract two Insets. |
static @NonNull Insets |
@RequiresApi(api = 29)Return a copy of the given |
@NonNull Insets |
@RequiresApi(value = 29)Return a copy this instance, converted to be an |
@NonNull String |
toString() |
Public fields
Public methods
add
public static @NonNull Insets add(@NonNull Insets a, @NonNull Insets b)
Add two Insets.
equals
public boolean equals(Object o)
Two Insets instances are equal if they belong to the same class and their fields are pairwise equal.
| Parameters | |
|---|---|
Object o |
the object to compare this instance with. |
| Returns | |
|---|---|
boolean |
true iff this object is equal |
max
public static @NonNull Insets max(@NonNull Insets a, @NonNull Insets b)
Returns the component-wise maximum of two Insets.
min
public static @NonNull Insets min(@NonNull Insets a, @NonNull Insets b)
Returns the component-wise minimum of two Insets.
of
public static @NonNull Insets of(@NonNull Rect r)
Return an Insets instance with the appropriate values.
of
public static @NonNull Insets of(int left, int top, int right, int bottom)
Return an Insets instance with the appropriate values.
| Parameters | |
|---|---|
int left |
the left inset |
int top |
the top inset |
int right |
the right inset |
int bottom |
the bottom inset |
subtract
public static @NonNull Insets subtract(@NonNull Insets a, @NonNull Insets b)
Subtract two Insets.
toCompatInsets
@RequiresApi(api = 29)
public static @NonNull Insets toCompatInsets(@NonNull Insets insets)
Return a copy of the given android.graphics.Insets instance, converted to be an Insets instance from AndroidX.
toPlatformInsets
@RequiresApi(value = 29)
public @NonNull Insets toPlatformInsets()
Return a copy this instance, converted to be an android.graphics.Insets instance from the platform.