The android.graphics Rect set is a class that allows the creation and manipulation of rectangles. This class is included in the android.graphics package.
Here are some code examples using the Rect set:
Example 1: Creating a rectangle
Rect rectangle = new Rect(10, 20, 100, 200);
In this example, a rectangle object is created with the coordinates (10, 20) as the top-left corner and (100, 200) as the bottom-right corner.
Example 2: Changing the dimensions of a rectangle
Rect rectangle = new Rect(10, 20, 100, 200); rectangle.set(20, 30, 150, 250);
In this example, the dimensions of the rectangle object created in Example 1 are changed using the set() method.
Example 3: Checking if a point is within a rectangle
Rect rectangle = new Rect(10, 20, 100, 200); boolean containsPoint = rectangle.contains(50, 50);
In this example, the contains() method is used to check if the point (50, 50) is within the rectangle object created in Example 1.
These code examples make use of the Rect set from the android.graphics package.
Java Rect.set - 30 examples found. These are the top rated real world Java examples of android.graphics.Rect.set extracted from open source projects. You can rate examples to help us improve the quality of examples.