Fresco SimpleDrawee查看像素化图像

时间:2015-09-28 10:33:02

标签: android image imageview fresco

SimpleDraweeView正在从外部存储器加载像素化的位图图像。

enter image description here

我正在通过此

将图像从assets文件夹复制到外部存储器
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;
}

然后我通过这个

设置SimpleDraweeView的图像
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);

1 个答案:

答案 0 :(得分:0)

这是一个已知的错误。它在Fresco 0.9.0中修复。如果您还在遇到此问题,请再试一次并打开一个新的GitHub问题。