如何使用毕加索Android在没有重新加载的情况下在AppWidget ListView中显示图像



嗨,我在appwidget listView中使用picasso具有缩略图。但它显示为滚动列表视图时的加载。我已经在远程视图中使用了以下代码将图像加载getViewat(int位置)方法,

try {
                Bitmap b = Picasso.with(context).load(url).get();
                remoteView.setImageViewBitmap(R.id.feed_image, b);
            } catch (Exception e) {
                e.printStackTrace();
            }

有什么方法可以将其存储在缓存中并避免重新加载?请给我一个主意。

尝试将图像直接加载到您的视图中。尝试以下操作:

String url= "your img url here";
Picasso.with(context).load(url).into(remoteView);

这将自动缓存图像和滚动不会提出其他网络请求,它将检查是否已经在缓存中。

在此处找到更多信息:https://guides.codepath.com/android/displaying-images-with-the-picasso-library

相关内容

最新更新