外部缓存 public class MyFresco extends Application { Context context; @Override public void onCreate() { super.onCreate(); context = this; Fresco.initialize(this,ImagePipelineConfig.newBuilder(this) .setMainDiskCacheConfig(DiskCacheConfig.newBuilder(this) .setMaxCacheSize(10*1024*1024) .setBaseDirectoryPath(new File(Environment.getExternalStorageDirectory().getAbsolutePath())) .build()).build()); } } 在适配器中写 //渐进式加载图片 //控件 SimpleDraweeView image=findViewById(R.id.img); Uri uri = Uri.parse(bean.getMasterPic());//网络图片资源 ImageRequest build = ImageRequestBuilder.newBuilderWithSource(uri) .setProgressiveRenderingEnabled(true).build();//设置渐进渲染已启用 AbstractDraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(build) .build(); //设置图片 image.setController(controller);
fresco外部缓存和渐进式加载图片
最新推荐文章于 2020-07-07 18:07:47 发布