Android 圆角/圆形view图片 描边

来源:互联网 发布:深圳网络营销黑马网络 编辑:程序博客网 时间:2024/05/16 17:05

这里写图片描述

    <com.gcssloop.widget.RCRelativeLayout        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_centerInParent="true"        app:round_as_circle="true"        app:round_corner="25dp"        app:stroke_color="@color/colorPrimary"        app:stroke_width="2dp">        <ImageView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@drawable/img" />    </com.gcssloop.widget.RCRelativeLayout>

可以在布局文件中配置的属性如下:

属性名称 摘要 是否必须设置 类型
round_corner 总体圆角半径 否 dp
round_corner_top_left 左上角圆角半径 否 dp
round_corner_top_right 右上角圆角半径 否 dp
round_corner_bottom_left 左下角圆角半径 否 dp
round_corner_bottom_right 右下角圆角半径 否 dp
round_as_circle 是否剪裁为圆形 否 boolean
stroke_width 描边半径 否 dp
stroke_color 描边颜色 否 color

allprojects {
repositories {
jcenter()
// 私有仓库地址
maven { url “http://lib.gcssloop.com/repository/gcssloop-central/” }
}
}

compile ‘com.gcssloop.widget:rclayout:1.4.2@aar’

github地址
https://github.com/GcsSloop/rclayout