可能重复:
How do you set a line's width when drawing in Android?
我见过How to draw a line in android但是如何设置线宽?我试着设置Paint
colorCenter = new Paint();
colorCenter.setAntiAlias(true);
colorCenter.setStrokeWidth(100);
colorCenter.setColor(0xFF00FFFF);
然后在onDraw()
canvas.drawLine(0, 0, 40, 40, colorCenter);
但总是1px。
我还尝试找到课程LineShape
并将其与ShapeDrawable
一起使用,但没有这样的课程!