How to draw filled polygon?

前端 未结 8 2104
生来不讨喜
生来不讨喜 2020-12-01 08:57

How to draw filled polygon in Android ?

8条回答
  •  不知归路
    2020-12-01 09:23

    You need to set the paint object to FILL

    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);
    

    etc.

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

提交回复
热议问题