繁体   English   中英

壁画-setDownsampleEnabled是/否?

[英]Fresco - setDownsampleEnabled true/false?

我在我的应用程序中使用Fresco并像这样初始化它:

    DiskCacheConfig diskCacheConfig = ...

    ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this)
            .setMainDiskCacheConfig(diskCacheConfig)
            .build();

    Fresco.initialize(this, imagePipelineConfig);

它在所有情况下都可以正常工作,但只有一种:“大图像大列表”可滚动视图。 (在这种情况下真的很慢)。

我阅读了有关调整大小的文档,然后使用setDownsampleEnabled(true)更改了Fresco初始化

    ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this)
            .setMainDiskCacheConfig(diskCacheConfig)
            .setDownsampleEnabled(true) // faster for downsampling of big images
            .build();

    Fresco.initialize(this, imagePipelineConfig);

在此“大量大图像列表”视图中效果很好...但是对于其他图像效果不佳,尤其是当我确实全屏显示图像时。 图像有点“模糊”,请参阅这篇文章

题:

是否可以仅对我的应用程序的“一部分”使用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(...),一次是与我的应用程序一起调用,第二次是我的活动显示完整列表。

我该怎么办?

谢谢。

配置:(最新)壁画1.5.0

不幸的是,Fresco当前不支持更改下采样配置。 更改此设置将需要进行一些内部更改。 随时发送拉取请求以添加此功能:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM