2 ssummeraw ssummeraw 于 2013.09.02 16:11 提问

关于 ondraw() 式样的问题

我使用下面的代码画了一个视图:

@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);
    }

输出如下:
CSDN移动问答

但是我想删除 drawArc底线,像这样:
CSDN移动问答
如何实现呢?

1个回答

shaojie519
shaojie519   2013.09.04 10:24

canvas.drawArc(rectl, 90, 180, false, paint);
canvas.drawArc(rectr, 270, 180, false, paint);

由第四个useCenter的属性决定

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!