定义paint画笔
private Paint mPaintCircle;
mPaintCircle = new Paint();
mPaintCircle.isAntiAlias();
mPaintCircle.setColor(Color.parseColor("#ffffff"));
mPaintCircle.setStrokeWidth(30f);
mPaintCircle.setStyle(Paint.Style.STROKE);
//设置模糊背景
BlurMaskFilter blurMaskFilter = new BlurMaskFilter(20, BlurMaskFilter.Blur.NORMAL);
mPaintCircle.setMaskFilter(blurMaskFilter);
ondraw方法下画圆:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int width = getMeasuredWidth();
int height = getMeasuredHeight();
RectF rectF1 = new RectF(30,30,width-30,height-30);
//画圆
canvas.drawArc(rectF2, 0, 360, true, mPaintCircle);
}