0

I would like to create the same shape as depicted in Transparent half circle cut out of a div using Android drawables and fill the created circle with a round button, is creating this shape (not the round button) possible? Preferably with drawables and xml only, but I guess using paint and canvas is fine too.

So far I was thinking to use the solution from this post to create a transparent circle at the desired position:

Paint mPaint = new Paint();
mPaint.setColor(0xFFFFFF);
mPaint.setAlpha(0);
mPaint.setAntiAlias(true);
mPaint.setColor(Color.TRANSPARENT);
mPaint.setXfermode(new PorterDuffXfermode(
        PorterDuff.Mode.CLEAR));

But can this be done non-programatically?

Community
  • 1
  • 1
Gooey
  • 4,740
  • 10
  • 42
  • 76

1 Answers1

0

1) Create drawable oval with white color in xml.

2) Create a Relative layout with black background.

3) Draw the image with background of oval drawable over relative Layout.

D.J
  • 1,439
  • 1
  • 12
  • 23
  • That would work. But in my case I would like to use a semi-transparent background. If the background is opaque then you will see a color difference. – Gooey Sep 30 '16 at 13:47
  • I guess I will make a custom view that extends e.g. a relativelayout. Will update if I succeed. – Gooey Sep 30 '16 at 14:25