Java android.graphics Rect fields, constructors, methods, implement or subclass

Example usage for Java android.graphics Rect fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.graphics Rect.

The text is from its open source code.

Constructor

Rect(int left, int top, int right, int bottom)
Create a new rectangle with the specified coordinates.
Rect()
Create a new empty Rect.
Rect(Rect r)
Create a new rectangle, initialized with the values in the specified rectangle (which is left unmodified).

Method

intcenterX()
intcenterY()
booleancontains(int x, int y)
Returns true if (x,y) is inside the rectangle.
booleancontains(Rect r)
Returns true iff the specified rectangle r is inside or equal to this rectangle.
booleanequals(Object o)
floatexactCenterX()
floatexactCenterY()
StringflattenToString()
Return a string representation of the rectangle in a well-defined format.
intheight()
voidinset(int dx, int dy)
Inset the rectangle by (dx,dy).
booleanintersect(Rect r)
If the specified rectangle intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
booleanintersect(int left, int top, int right, int bottom)
If the rectangle specified by left,top,right,bottom intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
booleanintersects(int left, int top, int right, int bottom)
Returns true if this rectangle intersects the specified rectangle.
booleanintersects(Rect a, Rect b)
Returns true iff the two specified rectangles intersect.
booleanisEmpty()
Returns true if the rectangle is empty (left >= right or top >= bottom)
voidoffset(int dx, int dy)
Offset the rectangle by adding dx to its left and right coordinates, and adding dy to its top and bottom coordinates.
voidoffsetTo(int newLeft, int newTop)
Offset the rectangle to a specific (left, top) position, keeping its width and height the same.
voidset(int left, int top, int right, int bottom)
Set the rectangle's coordinates to the specified values.
voidset(Rect src)
Copy the coordinates from src into this rectangle.
voidsetEmpty()
Set the rectangle to (0,0,0,0)
booleansetIntersect(Rect a, Rect b)
If rectangles a and b intersect, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
voidsort()
Swap top/bottom or left/right if there are flipped (i.e.
StringtoShortString()
Return a string representation of the rectangle in a compact form.
StringtoString()
RectunflattenFromString(String str)
Returns a Rect from a string of the form returned by #flattenToString , or null if the string is not of that form.
voidunion(int left, int top, int right, int bottom)
Update this Rect to enclose itself and the specified rectangle.
voidunion(Rect r)
Update this Rect to enclose itself and the specified rectangle.
intwidth()