Android glide 4.7 加载 使用

借鉴博客

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  



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值