Skip to content Skip to sidebar Skip to footer

Drawing Shape Programmatically With Part Corners Rounded Only

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.

Solution 1:

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

Modifying the values for your case:

Pathp=newPath();
PaintpaintN=newPaint();
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);

Post a Comment for "Drawing Shape Programmatically With Part Corners Rounded Only"