我正在尝试在自定义视图中绘制此自定义形状。我必须中风并填充此形状。
rect.set(0, 0, width, height);
canvas.drawRoundRect(rect, cornerRadius, cornerRadius, paint);
path.moveTo(x, y);
...
path.close();
canvas.drawPath(path, paint);
如何使用Path绘制带有笔触的完整形状,这是真的吗?
答案 0 :(得分:1)
要描画路径,应在用于路径的绘画上设置描边:
val paint = Paint()
paint.style = Paint.Style.STROKE
paint.strokeWidth = BASE_STROKE_WIDTH
paint.isAntiAlias = true
paint.color = ContextCompat.getColor(context, R.color.your_color)
companion object {
const val BASE_STROKE_WIDTH = 20.0f
}