开发者

drawRoundRect not showing rounded corners or nothing at all

开发者 https://www.devze.com 2023-01-18 12:34 出处:网络
The following code snippet draws a red rectangle: RectF rectangle = new RectF(50, 100, 100, 50); Paint paint = new Paint();

The following code snippet draws a red rectangle:

RectF rectangle = new RectF(50, 100, 100, 50);
Paint paint = new Paint();
paint.setColor(Color.RED);
ca开发者_如何学Gonvas.drawRoundRect(rectangle, 0, 0, paint);

However if i change rx and ry both to a positive value, say 5, than nothing is shown. Any ideas?


Your rectangle definition is incorrect. The parameters of a RectF are left, top, right and bottom, not x, y, width and height. Try with 50, 100, 150, 150 for instance.

0

精彩评论

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