4

I am trying to draw on canvas an arc this way :

canvas.drawArc(getCircleRect(), 90, 270, true, PaintCreator.createStrokePaintForArc());

.. but there is no visible effect

The bounds of the Rect getting from getCircleRect() are correct , and I can draw the rect this way (just for a test) :

canvas.drawRect(getCircleRect(), PaintCreator.createStrokePaintForArc());

any idea why drawRect is working and drawArc not ? thanx


    @Override
public void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    canvas.save();
    // not working
    canvas.drawArc(getCircleRect(), 90, 270, true, PaintCreator.createFillPaintArc());
    // working well
    canvas.drawRect(getCircleRect(), PaintCreator.createStrokePaintForArc());
    // working well
    canvas.drawCircle(x, y, RADIUS, fillPaint);
    move = false;
    canvas.restore();
}
4

1 回答 1

0

我不确定,但我认为你的油漆对象可能是问题所在。尝试这个

Paint mBgPaints = new Paint();
mBgPaints.setAntiAlias(true);
mBgPaints.setStyle(Paint.Style.FILL);
mBgPaints.setColor(Color.BLUE);
mBgPaints.setStrokeWidth(0.5f);
canvas.drawArc(getCircleRect(), 90, 270, true, mBgPaints);
于 2012-04-12T09:22:09.650 回答