【发布时间】:2015-09-03 10:40:12
【问题描述】:
我目前正在使用 Volley Image Loader 在我的应用程序中加载和缓存图像。缓存工作正常,但我看到当我尝试将相同的网络图像加载到不同大小的 ImageView 中时,缓存不会被命中。我相信这是因为 ImageLoader 中的 getCacheKey 将位图的大小附加到键上:
private static String getCacheKey(String url, int maxWidth, int maxHeight) {
return (new StringBuilder(url.length() + 12)).append("#W").append(maxWidth).append("#H").append(maxHeight).append(url).toString();
}
如何保存 Volley 正在下载的图像并将其用于我需要的所有不同尺寸,而不必为相同但尺寸不同的图像发出另一个网络请求?
谢谢
【问题讨论】:
标签: android image caching bitmap android-volley