Taimur
Taimur

Reputation: 3231

Android layout - how to draw a hole in a rectangle

I need to create a rounded rectangle with a semi-circular section cut out of the bottom of it - how do I go about this? Sorry for the extremely open ended question - I just have no idea where to start looking to figure it out.

Thanks

Upvotes: 0

Views: 1239

Answers (1)

ElDuderino
ElDuderino

Reputation: 3263

You can use PorterDuffXfermodes...

Paint clear = new Paint(Paint.ANTI_ALIAS_FLAG);
clear.setXfermode(new PorterDuffXfermode(Mode.CLEAR));

Then just draw with this paint.

And for the semi circular thing, check out canvas.drawArc() and pathes.

Upvotes: 2

Related Questions