我正在使用 Picasso 库将存储在我的服务器上的图像加载到我的 android 应用程序。 我正在使用普通代码来执行此操作。
Picasso.with(context)
.load(url)
.resize(50, 50)
.centerCrop()
.into(imageView)
但现在我想使用 id = myList
将此图像设置为我的 ListView 的背景。
如有任何帮助,我们将不胜感激。
谢谢。 :D
最佳答案
您可以尝试覆盖 new target()
实现来设置您的 View 。
Picasso.with(context).load(url).into(new Target() {
@Override public void onSuccess(Bitmap bitmap) {
// Set imageview bitmap here.
// Do other stuff.
}
@Override public void onError() {
}
});
请注意,除非您在 Target 中实现 hashCode/equals,否则以上内容在 ListView 中不起作用。
关于android - 将 Picasso 图像设置为 ListView 背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24496592/