Glide 集成
Glide 集成
注意
在使用 Transform 之前,请确保您已经集成了 Glide 库。
dependencies {
// QmBlurView Transform 依赖项
implementation 'com.qmdeve:QmBlurView.Transform:<Version>'
// Glide 依赖项
implementation 'com.github.bumptech.glide:glide:<Glide_Version>'
}导入类
// Glide 主类
import com.bumptech.glide.Glide;
// QmBlurView 模糊转换类
import com.qmdeve.blurview.transform.glide.BlurTransformation;使用示例
Glide.with(this)
.load(R.drawable.image)
.apply(new RequestOptions().transform(
new CenterCrop(),
/**
* 使用模糊转换
* new BlurTransformation() // 默认模糊半径 25f,圆角 0
* new BlurTransformation(float blurRadius) // 自定义模糊半径, 无圆角
* new BlurTransformation(float blurRadius, float roundedCorners) // 自定义模糊半径和圆角
*/
new BlurTransformation(24f, 50)
))
.into(imageView);构造函数
| 构造函数 | 说明 |
|---|---|
BlurTransformation() | 使用默认模糊半径 25f, 无圆角 创建模糊转换 |
BlurTransformation(float blurRadius) | 使用自定义模糊半径, 无圆角 创建模糊转换 |
BlurTransformation(float blurRadius, float roundedCorners) | 使用自定义模糊半径和自定义圆角创建模糊转换 |