借鉴博客
https://blog.csdn.net/guolin_blog/article/details/53759439
这个博客是glide3.7介绍,当然后面还有一些源码讲解、功能扩展等一些介绍
接入
https://github.com/bumptech/glide 版本4.7
https://github.com/bumptech/glide/tree/3.0 版本3.8
这个是glide的github地址
https://bumptech.github.io/glide/doc/download-setup.html
这个是设置文档介绍
repositories {
mavenCentral()
google()
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
}
加载方式
GlideApp
.with(myFragment)
.load(url)
.centerCrop()
.placeholder(R.drawable.loading_spinner)
.into(myImageView);
如果您需要支持较旧版本的Android,请使用V3版本 V3版本,但不会主动维护。
repositories { mavenCentral() } dependencies { compile 'com.github.bumptech.glide:glide:3.8.0' compile 'com.android.support:support-v4:19.1.0' }
加载方式
Glide.with(myFragment)
.load(url)
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.NONE) // 禁用掉Glide的缓存功能。
.placeholder(R.drawable.loading_spinner) // 占位图
.error(R.drawable.error) // 错误图
.asBitmap() // 只允许加载静态图片 同理还有.asGif()
.override(100, 100) // 指定大小
加载方式基本一样,介绍源码的
https://blog.csdn.net/guolin_blog/article/details/53939176