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