转发
https://blog.youkuaiyun.com/zhangkaiyazky/article/details/79562296
这篇文章介绍了基本用法,但是最新的4.8.0版本不可以如下调用.error .placeholder
Glide.with(this)
.load(url)
.placeholder(R.drawable.loading)
.error(R.drawable.error)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(imageView);
1.app build.grandle导入
//Glide
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
2.可以使用apply方法,代替error placeholder
Glide.with(this).load("http://cn.bing.com/az/hprichbg/rb/Dongdaemun_ZH-CN10736487148_1920x1080.jpg")
.apply(RequestOptions.placeholderOf(R.mipmap.ic_launcher))
.apply(RequestOptions.fitCenterTransform())
.into(imageView);