borderPaint.setStrokeWidth(borderWidth);
// 设置画笔风格
borderPaint.setStyle(Paint.Style.STROKE);
// 设置画笔颜色
borderPaint.setColor(borderColor);
// 分割线画笔
divingPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
divingPaint.setAntiAlias(true);
divingPaint.setStrokeWidth(lineWidth);
divingPaint.setColor(divingColor);
divingPaint.setStyle(Paint.Style.FILL);
// 圆心画笔
circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
circlePaint.setAntiAlias(true);
circlePaint.setStyle(Paint.Style.FILL);
circlePaint.setColor(circleColor);
circlePaint.setStrokeWidth(radius);
}
下面正式开始
绘制边框
我们需要在 onDraw() 方法中绘制矩形边框
分别传入 RectF 矩形对象、圆角值和画笔
// 绘制圆角矩形
canvas.drawRoundRect(rectF, roundAngle, roundAngle, borderPaint);
绘制分割线
绘制分割线时,这里要注意,六个密码框是五条线
我们需要传入起始点、结束点和画笔参数进行绘制
// 绘制分割线,5个分割线
f