Various image styles cutting various image styles cutting: Circular, Star, heart, flower, and other scissors: Circle, Star, heart, flower, and other shapes-third-party open-source -- CustomShapeImageView,
The home page of the CustomShapeImageView project on github is: https://github.com/MostafaGazar/CustomShapeImageView
If you only need to obtain the circular, heart-shaped, and petal-shaped avatar images (see the Demo for details), you can simply set the Android CustomShapeImageView in XML format.
Change the shape to different raw values in the demo.
Test xml:
1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:orientation="vertical" 7 tools:context="com.example.testcustomshapeimageview.MainActivity" > 8 9 <com.meg7.widget.CustomShapeImageView10 android:layout_width="100dp"11 android:layout_height="100dp"12 android:layout_gravity="center_horizontal"13 android:scaleType="centerCrop"14 android:src="@drawable/test_girl"15 app:shape="circle" />16 17 <com.meg7.widget.CustomShapeImageView18 android:layout_width="100dp"19 android:layout_height="100dp"20 android:scaleType="centerCrop"21 android:src="@drawable/test_girl" />22 23 <com.meg7.widget.RectangleImageView24 android:layout_width="100dp"25 android:layout_height="100dp"26 android:layout_gravity="center_horizontal"27 android:scaleType="centerCrop"28 android:src="@drawable/test_girl" />29 30 <com.meg7.widget.SvgImageView31 android:layout_width="100dp"32 android:layout_height="100dp"33 android:scaleType="centerCrop"34 android:src="@drawable/test_girl"35 app:svg_raw_resource="@raw/shape_star" />36 37 </LinearLayout>