【问题标题】:Picasso : want to cache a image without displaying it .so that i can use it later毕加索:想缓存一张图片而不显示它。这样我以后可以使用它
【发布时间】:2016-07-13 10:27:51
【问题描述】:

我想用毕加索来缓存图像,因为我现在不想用它,可能以后再用

我得到的每一个地方都是

毕加索.with(this).load(url).into(imageView);

但这样做是在当前的图像视图中加载图像。我现在不想使用它。

【问题讨论】:

  • 也许您可以将 imageView 可见性设置为 GONE?
  • 我想过,但我不想那样做,别的什么
  • 您可以使用 Target 对象。这将使您可以访问位图,并且您可以简单地在目标对象中不执行任何任务,因此下次将 URL 加载到 ImageView 中时,它很可能会从缓存中获取。看看他们的文档:square.github.io/picasso/2.x/picasso/com/squareup/picasso/….

标签: android picasso


【解决方案1】:

如果您没有临时的TargetImageView,可以使用fetch 将其加载到缓存中,稍后再使用get

来自fetch上的文档:

当您想用图像预热缓存时,这很有用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    相关资源
    最近更新 更多