自由角度的ImageView,四个角都可定义不同的角度。
SmallImageView最低支持Android5.0(API level 21)
在settings.gradle文件中做如下配置
repositories { ... maven { url 'https://jitpack.io' } } 在app目录下的build.gradle文件中做如下配置
dependencies { implementation 'com.github.NightRainDream:SmallImageView:Latest_VERSION' } 在layout中引入如下View:
<com.night.image.SmallImageView android:layout_width="100dp" android:layout_height="100dp" app:customRadius="10dp" /> | 属性 | 说明 | 默认值 |
|---|---|---|
| customRadiusTopLeft | 左上角圆角直径 | 0F |
| customRadiusTopRight | 右上角圆角直径 | 0F |
| customRadiusBottomRight | 右下角圆角直径 | 0F |
| customRadiusBottomLeft | 左下角圆角直径 | 0F |
| customRadius | 四个角圆角直径(优先级最高) | 0F |
| customSquare | 是否强制View高和宽相等 | false |
/** * 设置圆角直径 * * @param radius 圆角直径 */ public void setRadius(final float radius) /** * 设置圆角直径 * * @param topLeft 左上角圆角直径 * @param topRight 右上角圆角直径 * @param bottomLeft 左下角圆角直径 * @param bottomRight 右下角圆角直径 */ public void setRadius(final float topLeft, final float topRight, final float bottomLeft, final float bottomRight) 