Insets
public
final
class
Insets
extends Object
java.lang.Object | |
↳ | 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
Fields | |
---|---|
public
static
final
Insets |
NONE
|
public
final
int |
bottom
|
public
final
int |
left
|
public
final
int |
right
|
public
final
int |
top
|
Public methods | |
---|---|
static
Insets
|
add(Insets a, Insets b)
Add two Insets. |
boolean
|
equals(Object o)
Two Insets instances are equal if they belong to the same class and their fields are pairwise equal. |
int
|
hashCode()
|
static
Insets
|
max(Insets a, Insets b)
Retrieves the maximum of two Insets. |
static
Insets
|
min(Insets a, Insets b)
Retrieves the minimum of two Insets. |
static
Insets
|
of(int left, int top, int right, int bottom)
Return an Insets instance with the appropriate values. |
static
Insets
|
of(Rect r)
Return an Insets instance with the appropriate values. |
static
Insets
|
subtract(Insets a, Insets b)
Subtract two Insets. |
static
Insets
|
toCompatInsets(Insets insets)
Return a copy of the given |
Insets
|
toPlatformInsets()
Return a copy this instance, converted to be an |
String
|
toString()
|
Inherited methods | |
---|---|
Fields
bottom
public final int bottom
left
public final int left
right
public final int right
top
public final int top
Public methods
add
public static Insets add (Insets a, Insets b)
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
public boolean equals (Object o)
Two Insets instances are equal if they belong to the same class and their fields are pairwise equal.
Parameters | |
---|---|
o |
Object : the object to compare this instance with. |
Returns | |
---|---|
boolean |
true iff this object is equal o
|
hashCode
public int hashCode ()
Returns | |
---|---|
int |
max
public static Insets max (Insets a, Insets b)
Retrieves the maximum of two Insets.
Parameters | |
---|---|
a |
Insets : The first Insets. |
b |
Insets : The second Insets. |
Returns | |
---|---|
Insets |
max(a, b), i. e. the larger of every inset on every side is taken for the result. |
min
public static Insets min (Insets a, Insets b)
Retrieves the minimum of two Insets.
Parameters | |
---|---|
a |
Insets : The first Insets. |
b |
Insets : The second Insets. |
Returns | |
---|---|
Insets |
min(a, b), i. e. the smaller of every inset on every side is taken for the result. |
of
public static Insets of (int left, int top, int right, int bottom)
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 |
of
public static Insets of (Rect r)
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 |
subtract
public static Insets subtract (Insets a, Insets b)
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
public static Insets toCompatInsets (Insets insets)
Return a copy of the given Insets
instance, converted to be an
Insets
instance from AndroidX.
Parameters | |
---|---|
insets |
Insets |
Returns | |
---|---|
Insets |
toPlatformInsets
public Insets toPlatformInsets ()
Return a copy this instance, converted to be an Insets
instance
from the platform.
Returns | |
---|---|
Insets |
toString
public String toString ()
Returns | |
---|---|
String |