Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation("com.github.FPhoenixCorneaE:TrapezoidImageView:$latest")
}
<com.fphoenixcorneae.widget.trapezoidview.TrapezoidImageView
android:id="@+id/iv_image_3"
android:layout_width="match_parent"
android:layout_height="185dp"
android:layout_marginTop="8dp"
android:scaleType="centerCrop"
android:src="@mipmap/img_3"
app:trapezoidIncline="100dp"
app:trapezoidRadius="20dp"
app:trapezoidShadeColors="@array/ShadeColors_3" />
mIvImage1?.apply {
// 梯形上底与下底长度差
incline = 120f
// 圆角大小
radius = 20f
// 遮罩渐变颜色组
shadeColor = resources.getIntArray(R.array.ShadeColors_1)
}
Glide.with(mIvImage1!!)
.load(IMAGE_URL)
.into(mIvImage1!!)