FileDocCategorySizeDatePackage
Insets.javaAPI DocAndroid 5.1 API3302Thu Mar 12 22:22:30 GMT 2015android.graphics

Insets

public class Insets extends Object
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.

hide

Fields Summary
public static final Insets
NONE
public final int
left
public final int
top
public final int
right
public final int
bottom
Constructors Summary
private Insets(int left, int top, int right, int bottom)


             
        this.left = left;
        this.top = top;
        this.right = right;
        this.bottom = bottom;
    
Methods Summary
public booleanequals(java.lang.Object o)
Two Insets instances are equal iff they belong to the same class and their fields are pairwise equal.

param
o the object to compare this instance with.
return
true iff this object is equal {@code o}

        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Insets insets = (Insets) o;

        if (bottom != insets.bottom) return false;
        if (left != insets.left) return false;
        if (right != insets.right) return false;
        if (top != insets.top) return false;

        return true;
    
public inthashCode()

        int result = left;
        result = 31 * result + top;
        result = 31 * result + right;
        result = 31 * result + bottom;
        return result;
    
public static android.graphics.Insetsof(int left, int top, int right, int bottom)
Return an Insets instance with the appropriate values.

param
left the left inset
param
top the top inset
param
right the right inset
param
bottom the bottom inset
return
Insets instance with the appropriate values

        if (left == 0 && top == 0 && right == 0 && bottom == 0) {
            return NONE;
        }
        return new Insets(left, top, right, bottom);
    
public static android.graphics.Insetsof(Rect r)
Return an Insets instance with the appropriate values.

param
r the rectangle from which to take the values
return
an Insets instance with the appropriate values

        return (r == null) ? NONE : of(r.left, r.top, r.right, r.bottom);
    
public java.lang.StringtoString()

        return "Insets{" +
                "left=" + left +
                ", top=" + top +
                ", right=" + right +
                ", bottom=" + bottom +
                '}";