1、添加依赖
dependencies{
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
2、具体的方法
RequestOptions options=new RequestOptions();
options.placeholder(R.drawable.loading); //添加占位图
options.error(R.drawable.error)
.centerCrop()//居中显示
.diskCacheStrategy(DiskCacheStrategy.NONE)//硬盘缓存
.skipMemoryCache(false)//是否采用内存缓存功能
.override(200,100)//显示图片的指定大小
.transform(new BlurTransformation(),new GrayscaleTransformation())//图片的模糊化和黑白化处理
RequestListener mListener=new RequestListener<Drawable>(){
@Override
public boolean onLoadFailed(GlideException e,Object model,Target<Drawable> target,b