Canvas is always the best way of creating any shape of views like circles, rectangles or etc…It also can be used to crop bitmaps to your desired shapes. However, what would you do when you want to hollow out views.
In this articles, I’m gonna share few tips to hollow out views using canvas.
Let’s draw a view normally
First, this is the simplest way of drawing a black circle with Canvas in Android.
The output would be like this below.
Let’s hollow out a view
Finally, let’s do the thing we want to. The code below is how it will be done.
There you go.
Recently, I created a library called “Spotlight” using the hollowing implementation that I explained in this article. please check this out, and it would be really appreciated if you give me a star!
Spotlight - Android Library that lights items for tutorials or walk-throughs etc...
Enjoy hollowing out views ;)