您好我通过使用下面的代码在弧周围绘制圆圈,它是完美的
double x = radius + (radius)*Math.cos(Math.toRadians(45));
double y = radius + (radius)*Math.sin(Math.toRadians(45));
double x1 = radius + (radius)*Math.cos(Math.toRadians(135));
double y1 = radius + (radius)*Math.sin(Math.toRadians(135));
double x2 = radius + (radius)*Math.cos(Math.toRadians(225));
double y2 = radius + (radius)*Math.sin(Math.toRadians(225));
double x3 = radius + (radius)*Math.cos(Math.toRadians(315));
double y3 = radius + (radius)*Math.sin(Math.toRadians(315));
double x4 = radius + (radius)*Math.cos(Math.toRadians(0));
double y4 = radius + (radius)*Math.sin(Math.toRadians(0));
double x5 = radius + (radius)*Math.cos(Math.toRadians(180));
double y5 = radius + (radius)*Math.sin(Math.toRadians(180));
canvas.drawCircle(getStartingDegree(), getProgressAngle(), 100, innerCirclePaint);
canvas.drawCircle((int)(x-10), (int)(y-10), 20, finishedPaint);
canvas.drawCircle((int)(x1-10), (int)(y1-10), 20, finishedPaint);
canvas.drawCircle((int)(x2-10), (int)(y2-10), 20, finishedPaint);
canvas.drawCircle((int)(x3-10), (int)(y3-10), 20, finishedPaint);
canvas.drawCircle((int)(x4-10), (int)(y4-10), 20, finishedPaint);
canvas.drawCircle((int)(x5-10), (int)(y5-10), 20, finishedPaint);
屏幕截图如下
但如果我使用drawBitmap而不是圆圈,那么它就不能完美展示
canvas.drawCircle((int)(x-10), (int)(y-10), 20, finishedPaint);
canvas.drawCircle((int)(x1-10), (int)(y1-10), 20, finishedPaint);
drawBitmap下方的应该显示在圈子的位置
canvas.drawBitmap(bitmap, (int)(x-bitmap.getWidth()/2), (int)(y-getHeight()/2), null);
canvas.drawBitmap(bitmap, (int)(x1-bitmap.getWidth()/2), (int)(y1-getHeight()/2), null);
截图位于下方
你可以看到drawBitap应该显示在圆圈的位置,但是它显示在小圆圈的上方