Drawing shape programmatically with part corners rounded only

核能气质少年 提交于 2020-01-03 21:04:16

问题


Problem here is to draw this kind of shape in onDraw method.

I've tried using Path and CornerPathEffect but the bottom corners need to be sharp, so it was not working solution.


回答1:


Problem here is to draw this kind of shape in onDraw method.

Modifying the values for your case:

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);


来源:https://stackoverflow.com/questions/13878804/drawing-shape-programmatically-with-part-corners-rounded-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!