David Prun
David Prun

Reputation: 8433

Rectangle in Android

canvas.drawRect(left, top, right, bottom, paint);

Say I want to draw rectangle

x=30 to x=35 of height y=50. What would be the values in above method. Thank you very much.

Upvotes: 0

Views: 2039

Answers (1)

Josiah
Josiah

Reputation: 4854

Try:

canvas.drawRect(30,0,35,50,Reference_to_Paint_Object);

This is assuming that you want the rectangle to start at the top of the screen. Change the 2nd parameter to set the top location. You will also need to construct a Paint object to pass to the last parameter.

Upvotes: 1

Related Questions