如何使用 Picasso 图像缓存?
How do I use Picasso Image Caching?
我需要访问使用 Picasso 转换(或裁剪)后缓存的图像。
我正在做的是获取一个大的图像资源,在 运行 时从中裁剪出一块屏幕大小,并将其设置为 RelativeLayout
的背景。到目前为止,我已经使用 Picasso 成功地完成了这项工作。
稍后在应用程序中,我通过调用更改应用程序布局:
setContentView(R.layout.OTHER_LAYOUT);
然后我想访问毕加索存储图像裁剪版本的缓存,并将 OTHER_LAYOUT
的背景动态设置为裁剪图像的存储版本。
This S.O. post 似乎与访问 Picasso 在设备上缓存的位图有关。
我正在考虑尝试这个解决方案。但是一位用户的评论(对接受的答案的评论)让我想知道是否有更好的方法。复杂的解决方案通常看起来更容易出错。
"it seems can work. but in my opinion, it is not well offer. files are being saved somewhere. lib should give them to developers. it would be good instead of adding millions feature to picasso lib, adding very simple and essential features. I gave up to use picasso because of this. It has millions garbage features and very limited nice features."
Picasso 是否可以通过某种方式访问已转换和缓存的图像,并在其他地方使用它(以一种简单易用的方式)?
如果没有,另一个图书馆会不会给我更大的便利?
不要想太多关于重用缓存图像,Picasso 非常擅长这一点并且针对它进行了很好的优化。只需加载相同的 URL / drawable 并应用转换。如果 Picasso 已经缓存了它,它会非常快,你可以检查它是否被 setIndicatorsEnabled(true)
在 Picasso 实例上缓存。
我需要访问使用 Picasso 转换(或裁剪)后缓存的图像。
我正在做的是获取一个大的图像资源,在 运行 时从中裁剪出一块屏幕大小,并将其设置为 RelativeLayout
的背景。到目前为止,我已经使用 Picasso 成功地完成了这项工作。
稍后在应用程序中,我通过调用更改应用程序布局:
setContentView(R.layout.OTHER_LAYOUT);
然后我想访问毕加索存储图像裁剪版本的缓存,并将 OTHER_LAYOUT
的背景动态设置为裁剪图像的存储版本。
This S.O. post 似乎与访问 Picasso 在设备上缓存的位图有关。
我正在考虑尝试这个解决方案。但是一位用户的评论(对接受的答案的评论)让我想知道是否有更好的方法。复杂的解决方案通常看起来更容易出错。
"it seems can work. but in my opinion, it is not well offer. files are being saved somewhere. lib should give them to developers. it would be good instead of adding millions feature to picasso lib, adding very simple and essential features. I gave up to use picasso because of this. It has millions garbage features and very limited nice features."
Picasso 是否可以通过某种方式访问已转换和缓存的图像,并在其他地方使用它(以一种简单易用的方式)?
如果没有,另一个图书馆会不会给我更大的便利?
不要想太多关于重用缓存图像,Picasso 非常擅长这一点并且针对它进行了很好的优化。只需加载相同的 URL / drawable 并应用转换。如果 Picasso 已经缓存了它,它会非常快,你可以检查它是否被 setIndicatorsEnabled(true)
在 Picasso 实例上缓存。