【发布时间】:2016-04-21 09:17:14
【问题描述】:
目前我正在加载图像,即使用户没有滚动查看,所以当他将在列表承包商上从 Picasso 缓存中更快地加载图像时
private void createImageCatch(ArrayList<Article> items) {
for (int i = 0; i < items.size(); i++) {
Article article = (Article) items.get(i);
if (article.getImageUrl() != null
&& article.getImageUrl().length() > 0)
Picasso.with(mContext).load(article.getImageUrl())
.fetch();
}
}
这是完美的工作,即使用户快速滚动图像也准备好了,但这是最好的方法吗?
改进更新 - 添加静态布尔值以确保此方法仅调用一次,如果图像是在服务器端添加的,这对于滚动时加载的少量图像来说没什么大不了的,只要它们必须已经在缓存中。
【问题讨论】:
-
取决于 ImageView 大小 && ListView 项目数
-
我不认为这是正确的方法,预取你不需要的数据是一种矫枉过正的方式。
-
小图,30左右。我也没有看到这是最好的方法,这就是我问的原因。我想避免在很短的时间内出现空白图像
-
短时间的空白图片对用户来说没什么大不了的,除了可以使用占位符图片。
-
这是一个非常大的应用程序,我希望它尽可能流畅......
标签: android caching picasso android-image