zoukankan      html  css  js  c++  java
  • 对图片进行各种样式裁对图片进行各种样式裁剪:圆形、星形、心形、花瓣形等剪:圆形、星形、心形、花瓣形等--第三方开源--CustomShapeImageView

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

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

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

    测试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.CustomShapeImageView
    10         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.CustomShapeImageView
    18         android:layout_width="100dp"
    19         android:layout_height="100dp"
    20         android:scaleType="centerCrop"
    21         android:src="@drawable/test_girl" />
    22 
    23     <com.meg7.widget.RectangleImageView
    24         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.SvgImageView
    31         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>
  • 相关阅读:
    JQuery源码解析-Dom加载过程
    多个script标签的作用域
    JQuery源码解析-JQuery的工具方法(1)
    JQuery源码解析-JQuery的工具方法
    JQuery源码解析-JQuery.extend()方法
    JQuery源码解析-添加JQuery的一些方法和属性
    中兴捧月算法精英挑战赛-迪杰斯特拉派
    C语言中的内存相关问题
    动态内存管理
    虚函数与虚继承小结
  • 原文地址:https://www.cnblogs.com/zzw1994/p/5008940.html
Copyright © 2011-2022 走看看