Android图片缓存框架 - Fresco的DraweeController(六)

目录

1.Fresco 简介

2. Fresco 文档

3. Fresco开发步骤

4. Fresco加载图片6种方式

5. Drawees xm属性设置

6 Fresco实现圆角或圆形图片

7. DraweeHierarchy设置

8. Fresco的DraweeController

8.1 设置 RetryImage

8.2 设置缩略图

9. ControllerListener 图片加载监听

10. Fresco的ImageRequest

11 Fresco的显示GIF

12 Fresco的BasePostprocessor图片处理

13.Fresco设置和清除缓存


8. Fresco的DraweeController

8.1 设置 RetryImage

setRetryImage(resId) 设置图片下载失败后,重试下载时显示图片;

setTapToRetryEnabled()设置是否开启重试图片;

GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
hierarchy.setRetryImage(R.mipmap.img2);

draweeView.setHierarchy(hierarchy);

DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(imgUrlError)
.setTapToRetryEnabled(true).build();

draweeView.setController(controller);

8.2 设置缩略图

ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imgUrl1)).
                             setLocalThumbnailPreviewsEnabled(true).build();

DraweeController controller = Fresco.newDraweeControllerBuilder()
                              .setLowResImageRequest(imageRequest)
                              .setImageRequest(ImageRequest.fromUri(imgUrl2))
                              .build();

draweeView.setController(controller);

 

你可能感兴趣的:(Android图片缓存框架,Fresco,Android开发,Android图片缓存框架,Fresco)