如何绘制多边形填充?多边形

2023-09-13 00:59:02 作者:一季烟雨凉

如何绘制多边形填充在Android的?

How to draw filled polygon in Android ?

推荐答案

您需要设置漆对象填充

Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);

然后就可以画出任何你想要的,它会被填充。

Then you can draw whatever you want, and it will be filled.

   canvas.drawCircle(20, 20, 15, paint);
   canvas.drawRectangle(60, 20, 15, paint);

等。

有关更复杂的形状,你需要使用路径对象。

For more complex shapes you need to use the PATH object.