【问题标题】:Picasso image caching in recylceviewrecylceview中的毕加索图像缓存
【发布时间】:2019-09-14 05:25:33
【问题描述】:

我正在使用带有 recylerview 的毕加索。 Picasso 将来自 url 的 imageview 填充为:

Picasso.get().url("url").center().fit().into(ivImageview)

但是当我向上和向下滚动时,我注意到图像是空白的,然后它显示了图片(意味着它每次都在下载图像)。

毕加索不应该缓存图像并重复使用它吗?有什么我需要启用的吗? 谢谢

【问题讨论】:

标签: android picasso


【解决方案1】:

将此添加到您的recyclerview

recyclerView.setHasFixedSize(true);
recyclerView.setItemViewCacheSize(20);
recyclerView.setDrawingCacheEnabled(true);

【讨论】:

    【解决方案2】:

    通常,毕加索会自动缓存加载的图像。您可以通过添加来检查它:

    setIndicatorsEnabled(true);
    setLoggingEnabled(true);
    

    这将显示图像的加载位置。 (不要忘记为发布应用删除它)

    请看:here

    【讨论】:

      猜你喜欢
      • 2014-04-10
      • 2015-05-07
      • 1970-01-01
      • 1970-01-01
      • 2021-02-21
      • 2013-08-31
      • 2015-10-16
      • 2016-01-20
      • 2017-10-14
      相关资源
      最近更新 更多