借鉴博客
https://blog.youkuaiyun.com/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.youkuaiyun.com/guolin_blog/article/details/53939176
本文介绍了Glide图片加载库的不同版本及其配置方法,并详细解释了如何使用Glide进行图片加载,包括设置缓存策略、占位图及错误图等高级功能。
671

被折叠的 条评论
为什么被折叠?



