Drawing shape programmatically with part corners rounded only

android, android-layout, shapes

Solution

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

Problem

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.

Original source