我有一个SimpleDraweeView,它正在通过控制器处理图像请求:
Postprocessor redMeshPostprocessor = new BasePostprocessor() {
@Override
public String getName() {
return "redMeshPostprocessor";
}
@Override
public CloseableReference<Bitmap> process(
Bitmap sourceBitmap,
PlatformBitmapFactory bitmapFactory) {
//custom processing on the bitmap and returning it
}
};
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(coverImage))
.setPostprocessor(redMeshPostprocessor)
.build();
PipelineDraweeController controller = (PipelineDraweeController)
Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(iv_cover.getController())
// other setters as you need
.build();
iv_cover.setController(controller);
然后,我想通过简单地说一下来更改SimpleDraweeView上的图像:
iv_cover.setImageURI(Uri.parse(url));
问题在于,在加载第二张图像时,有一瞬间,其中SimpleDraweeView显示占位符。如何避免呢?希望两个图像之间的过渡是无间隙且平滑的。谢谢!
最佳答案
你可以这样做:
PipelineDraweeController controller = (PipelineDraweeController)
Fresco.newDraweeControllerBuilder()
.setLowResImageRequest(previousRequest)
.setImageRequest(newRequest)
.setOldController(iv_cover.getController())
.build();
iv_cover.setController(controller);
这应该给您想要的行为。
关于java - Fresco :SimpleDraweeView总是在重置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36869182/