您的位置:首页 > Web前端 > CSS

对图片进行各种样式裁对图片进行各种样式裁剪:圆形、星形、心形、花瓣形等剪:圆形、星形、心形、花瓣形等--第三方开源--CustomShapeImageView

2015-12-01 00:33 561 查看


CustomShapeImageView在github上的项目主页是:https://github.com/MostafaGazar/CustomShapeImageView

如果仅仅是需要获取圆形、心形、花瓣形头像图片(具体看Demo),那么经过Android CustomShapeImageView简单XML设置就可以实现。

改不同的形状去demo中找不同的raw



测试xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.testcustomshapeimageview.MainActivity" >

<com.meg7.widget.CustomShapeImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:scaleType="centerCrop"
android:src="@drawable/test_girl"
app:shape="circle" />

<com.meg7.widget.CustomShapeImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/test_girl" />

<com.meg7.widget.RectangleImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:scaleType="centerCrop"
android:src="@drawable/test_girl" />

<com.meg7.widget.SvgImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/test_girl"
app:svg_raw_resource="@raw/shape_star" />

</LinearLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: