如何在安卓画布中绘制填充三角形?
2022-08-31 10:56:42
因此,我正在使用以下绘制方法中的代码在Android地图中绘制此三角形:
paint.setARGB(255, 153, 29, 29);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setAntiAlias(true);
Path path = new Path();
path.moveTo(point1_returned.x, point1_returned.y);
path.lineTo(point2_returned.x, point2_returned.y);
path.moveTo(point2_returned.x, point2_returned.y);
path.lineTo(point3_returned.x, point3_returned.y);
path.moveTo(point3_returned.x, point3_returned.y);
path.lineTo(point1_returned.x, point1_returned.y);
path.close();
canvas.drawPath(path, paint);
pointX_returned是我从田野中得到的坐标。它们基本上是纬度和经度。结果是一个不错的三角形,但内部是空的,因此我可以看到地图。有没有办法以某种方式填充它?