我使用下面的代码绘制视图
@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);
}
输出如下
但我希望,需要删除drawArc底线,如下所示,
如何实现这一目标?
答案 0 :(得分:1)
将drawArc的第三个参数设置为false。
useCenter意味着弧的中心也应该连接到两端,半圆和D之间的差异。