这里的问题是在 onDraw 方法中绘制这种形状。
我试过使用 Path
和 CornerPathEffect
但底角需要很尖,所以它不是可行的解决方案。
最佳答案
Problem here is to draw this kind of shape in onDraw method.
修改您的案例的值:
Path p = new Path();
Paint paintN = new Paint();
paintN.setAntiAlias(true);
paintN.setStyle(Style.FILL_AND_STROKE);
paintN.setColor(Color.YELLOW);
p.moveTo(40, 60);
p.quadTo(40, 40, 60, 40);
p.lineTo(180, 40);
p.quadTo(200, 40, 200, 60);
p.lineTo(200, 90);
p.lineTo(40, 200);
p.close();
canvas.drawPath(p, paintN);
关于android - 以编程方式绘制形状,仅使零件角变圆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13878804/