An extremely simple Squircle renderer for the Android canvas.
https://jitpack.io/#MicroRJ/android_superellipse
Step 1. Add Jitpack to your gradle script.
allprojects
{
repositories
{
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies
{
implementation 'com.github.MicroRJ:android_superellipse:v3.0.1-alpha'
}
<com.devrj.superellipse.SuperEllipseImageView
android:layout_width="256dp"
android:layout_height="256dp"
android:id="@+id/superView"
android:padding="24dp"
app:shapeBorderWidth="16dp"
android:src="@drawable/ic_baseline_music_note_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
XML | JAVA | Effect |
---|---|---|
shapeBackgroundColor | setShapeBackgroundColor(int) | Set the background color of the shape. |
shapeForegroundColor | setShapeForegroundColor(int) | Set the foreground color of the shape. (The border color) |
shapeBorderWidth | setShapeBorderWidth(float) | Set the border width of the shape. |
shapeCurveFactor | setShapeCurveFactor(float) | Set the curve factor of the shape. |
shapeRadius | setShapeRadius(float) | Set the radius of the shape. |
shapeScale | setShapeScale(float) | Set the scale of the shape. |
Get yourself some squircles.