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,

Source: Internet
Author: User

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>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.