我在我的应用中使用Fresco,initialize就像这样:
DiskCacheConfig diskCacheConfig = ...
ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this)
.setMainDiskCacheConfig(diskCacheConfig)
.build();
Fresco.initialize(this, imagePipelineConfig);
它在所有情况下都能正常工作,但其中一个:“巨大的大图像列表”可滚动视图。 (在这种情况下真的很慢)。
我阅读了有关resizing的文档,然后使用 setDownsampleEnabled(true)
更改了Fresco初始化 ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this)
.setMainDiskCacheConfig(diskCacheConfig)
.setDownsampleEnabled(true) // faster for downsampling of big images
.build();
Fresco.initialize(this, imagePipelineConfig);
对于这个“巨大的大图像列表”视图效果很好......但是其余部分效果不佳,尤其是当我全屏显示图像时。图像有点'模糊',请参阅this post。
问题:
是否可以仅对我应用的“部分”使用setDownsampleEnabled(true)? 我想要所有应用程序的“标准”设置,除了我想要 setDownsampleEnabled(true)的“庞大的大图像列表”。
也许有一种方法可以使用ImagePipelineConfig来配置它??
坦率地说,目前的情况几乎没问题,所以这不是什么大问题,但我想知道这是否可行,然后测试看结果。
注意:
我深入研究Fresco代码并看到了这一点:
package com.facebook.drawee.backends.pipeline;
...
public class Fresco {
...
public static void initialize(Context context, @Nullable ImagePipelineConfig imagePipelineConfig, @Nullable DraweeConfig draweeConfig) {
if(sIsInitialized) {
FLog.w(TAG, "Fresco has already been initialized! `Fresco.initialize(...)` should only be called 1 single time to avoid memory leaks!");
} else {
sIsInitialized = true;
}
...
}
...
所以我不敢两次调用Fresco.initialize(...),一次是我的应用程序,第二次是我的活动,我在其中显示完整列表。
我该怎么办?
感谢。
配置: (最新)Fresco 1.5.0
答案 0 :(得分:1)
不幸的是,Fresco目前不支持更改下采样配置。改变这种情况需要进行一些内部更改。随意发送拉取请求以添加此功能:)