gpt4 book ai didi

java - Fresco:SimpleDraweeView 总是重置

转载 作者:行者123 更新时间:2023-12-02 03:40:40 27 4
gpt4 key购买 nike

我有一个 SimpleDraweeView,它通过 Controller 处理图像请求:

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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com