Android 他人开源库自定义imageview实现图片圆角,操作简单
效果图:
1. 导入依赖
dependencies {
implementation 'io.github.FlyJingFish:ShapeImageView:1.5.6'
}
2. ShapeImageView 示例
<com.flyjingfish.shapeimageviewlib.ShapeImageView
android:id="@+id/iv_centerCrop"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginStart="10dp"
android:padding="10dp"
app:FlyJFish_shape="rectangle"
app:FlyJFish_shape_border="rectangle"
app:FlyJFish_shape_border_width="3dp"
app:FlyJFish_shape_border_angle="45"
app:FlyJFish_shape_left_top_radius="8dp"
app:FlyJFish_shape_right_top_radius="12dp"
app:FlyJFish_shape_right_bottom_radius="16dp"
app:FlyJFish_shape_left_bottom_radius="20dp"
app:FlyJFish_shape_border_left_top_radius="10dp"
app:FlyJFish_shape_border_right_top_radius="15dp"
app:FlyJFish_shape_border_right_bottom_radius="20dp"
app:FlyJFish_shape_border_left_bottom_radius="25dp"
app:FlyJFish_shape_border_gradient="true"
app:FlyJFish_shape_border_startColor="@color/purple_200"
app:FlyJFish_shape_border_endColor="@color/teal_700"
android:scaleType="centerCrop" />
具体属性使用查看如下地址:
https://github.com/FlyJingFish/ShapeImageView