目標是繪製一個具有代表時間切片的圓弧。我已經做到了這一點:畫布中圓弧之間的空間
的問題是,有每個拱之間的空白,我想刪除它。此外,弧不對齊。這是我的代碼:
int x = getWidth()/2;
int y = getHeight()/2;
int stroke = 20;
int radiusExternal = 250;
final RectF rect2 = new RectF();
rect2.set(x - radiusExternal, y - radiusExternal, x + radiusExternal, y + radiusExternal);
for (int i = 0; i < modProgram.getListEvents().size(); i++) {
ModEvent event = modProgram.getListEvents().get(i);
Paint paint2 = new Paint();
paint2.setColor(getColorEvent(event));
paint2.setStrokeWidth(stroke);
paint2.setAntiAlias(true);
paint2.setStrokeCap(Paint.Cap.BUTT);
paint2.setStyle(Paint.Style.STROKE);
int initialAngle = getInitialAngle(modProgram, event.getStartEvent());
int sweepAngle = getSweepAngle(modProgram, event, initialAngle);
canvas.drawArc(rect2, initialAngle, sweepAngle, false, paint2);
}
查看你的initialAngle和SweepAngle函數。我敢打賭你有一個錯誤。 – 2015-02-11 10:52:26
我檢查了這一點,每個角度與下一個弧的initialAngle相同。這很奇怪:( – Yeray 2015-02-11 12:44:52