Masking (Crop) Your Image in Android — is it that hard?
One of the most horrifying for beginner Android developers are finding out on how to mask an ImageView into a custom drawable shape. As I was surfing on the internet for a certain period of time, I’ve found out it’s not really a hard thing to do! In fact, there’s a library shipped and ready for your convenience.
How do we do this?
There’s this library called Android_Maskable_Layout created by Christophesmet. To implement it, first we must load it into your build.gradle
implementation 'com.github.christophesmet:android_maskable_layout:v1.2.0'
DONT FORGET TO RE-SYNC THE BUILD! For the usage, it’s very simple really. All you have to do, is copy paste this on your XML (No really, it’s that simple)
You don’t really have to play with your Java view file to play with it, you really just have to copy paste that.. IT’S THAT EASY
If you copy and paste it correctly, it should look something like this.