1
SimpleDraweeView正在從外部存儲裝載像素化位圖圖像。Fresco SimpleDraweeView像素化圖像
我通過這個
private OutputStream copy(InputStream in, OutputStream out) throws IOException{
// Transfer bytes from in to out
byte[] buf = new byte[in.available()];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
return out;
}
從資產文件夾中的圖像複製到外部存儲,然後我通過這個
Fresco.getImagePipeline().evictFromMemoryCache(uri);
Fresco.getImagePipelineFactory().getMainDiskStorageCache().remove(new SimpleCacheKey(uri.toString()));
Fresco.getImagePipelineFactory().getSmallImageDiskStorageCache().remove(new SimpleCacheKey(uri.toString()));
Postprocessor postprocessor = new BasePostprocessor() {
@Override
public void process(Bitmap bitmap) {
});
}
};
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setPostprocessor(postprocessor)
.build();
PipelineDraweeController controller = (PipelineDraweeController)
Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(header.getController())
.build();
header.setController(controller);