RVG
RVG

Reputation: 3576

Android - need help for ondraw() sample

i've used below code for draw a view

@Override
protected synchronized void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        paint.setStyle(Style.STROKE);
        paint.setAntiAlias(true);
        paint.setColor(BACKGROUND_COLOR);

        final RectF rectl = new RectF(0,0,2* padding,getHeight());
        final RectF rectr = new RectF(getWidth()-(2* padding),0,getWidth(),getHeight());

        canvas.drawLine(padding, 0, getWidth()-padding, 0, paint);
        canvas.drawLine(padding,getHeight()-1, getWidth()-padding, getHeight()-1, paint);
        canvas.drawArc(rectl, 90, 180, true, paint);
        canvas.drawArc(rectr, 270, 180, true, paint);
    }

The output is like below

enter image description here

but i expect, need to remove the drawArc bottom line , like this,

enter image description here

How to achieve this ?

Upvotes: 0

Views: 253

Answers (1)

alex
alex

Reputation: 6409

Set the 3rd argument of drawArc to false.

useCenter means that the center of the arc should also be connected to the ends, the difference between a semicircle and a D.

Upvotes: 1

Related Questions