简体   繁体   English

Android中的矩形

[英]Rectangle in Android

canvas.drawRect(left, top, right, bottom, paint); canvas.drawRect(左,上,右,下,油漆);

Say I want to draw rectangle 说我要画矩形

x=30 to x=35 of height y=50. 高度y = 50的x = 30到x = 35。 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. 您还需要构造一个Paint对象以传递给最后一个参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM