开发者

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜