Fresco&Glide图片库缩放处理

Fresco添加缩放支持


1. 添加gradle依赖

compile('com.facebook.fresco:fresco:1.0.0') {

excludemodule:'support-v4',group:'com.android.support'

}

// 配置fresco使用okhttp3发起网络请求

compile('com.facebook.fresco:imagepipeline-okhttp3:1.0.0') {

excludemodule:'okhttp',group:'com.squareup.okhttp3'

}

// 实现缩放效果

compile'com.autonavi.gxdtaojin:lib-cview-photodraweeview:1.0.0'

2. 用PhotoDraweeView替换fresco默认的SimpleDraweeView

mPhotoDraweeView.setPhotoUri(Uri.parse("http://your.image.url"));

3. 参考:

https://github.com/ongakuer/PhotoDraweeView

https://github.com/chrisbanes/PhotoView

https://www.fresco-cn.org/

Glide添加缩放支持


1. 添加gradle支持

// https://mvnrepository.com/artifact/com.github.bumptech.glide/glide

compilegroup:'com.github.bumptech.glide',name:'glide',version:'3.7.0'

// https://mvnrepository.com/artifact/com.github.chrisbanes.photoview/library

providedgroup:'com.github.chrisbanes.photoview',name:'library',version:'1.2.4'

2. 使用方法

首先通过glide给imageview设置bitmap,然后

Fresco&Glide图片库缩放处理_第1张图片

3. 参考资料

https://github.com/chrisbanes/PhotoView

https://mrfu.me/2016/02/27/Glide_Getting_Started/

https://github.com/bumptech/glide

你可能感兴趣的:(Fresco&Glide图片库缩放处理)