I have an image, a half circle frame image and I need to put that image inside this frame. But I need to apply mask to my image so it is only displayed inside frame.
For example this is my image:
And my desired result should be like that:
The red frame also an image view which inside is transparent.
How can I achieve this in Android?
There's a great tutorial on Styling Android blog in four parts that explains how you can achieve this.
Edit:
I've edited the code in part two of the tutorial and created the effect:
I just replaced the
drawRoundRect
at the end of the code withdrawOval
and it essentially draws a circle that half of it is out of canvas.