Is it possible to make an ImageView into a squircle? i.e not just rounded corners but a squircle? If so, how do you do it?
Basically, I want a list of icons that are squircles, so doing it in XML and setting the background on widget would be ideal.
Simply put a circular_crop. png in your drawable folder which is in the shape of your image dimensions (a square in my case) with a white background and a transparent circle in the center. You can use this image if you have want a square imageview.
A fast and free multi-language code editor and file manager for Android.
https://github.com/MicroRJ/Android_Superellipse_Library
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.MicroRJ:Android-Canvas-Squircle:1.0'
}
<com.microdevrj.superellipse.custom_superellipse_views.SuperEllipseImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:padding="64dp"
app:colorFill="@color/colorFill"
app:colorStroke="@color/colorStroke"
app:paintStyle="fillAndStroke"
app:strokeWidth="6dp" />
Feel free to look at the open-source files to learn how it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With