I am trying to draw a rectangle over a canvas and I am facing troubles to understand the in-depth of rectangle draw of Android. I\'ve read tutorials and every possible but I
Here is my approach simple and easy
int x = 100; //position coordinate from left
int y = 100; //position coordinate from top
int w = 100; //width of the rectangle
int h = 100; //height of the rectangle
drawRectangle(x, y, w, h, canvas, paint);
and here is my function
public void drawRectangle(int left, int top, int right, int bottom, Canvas canvas, Paint paint) {
right = left + right; // width is the distance from left to right
bottom = top + bottom; // height is the distance from top to bottom
canvas.drawRect(left, top, right, bottom, paint);
}
it works pretty well