Picasso.with(context).load(Image.get(position))。into(new Target(){@Override public void onBitmapLoaded(Bitmap bitmap,Picasso.LoadedFrom from {Log.d(" abhinav1& #34;," onBitmapLoaded:" + bitmap); r.setBackground(new BitmapDrawable(bitmap));} @覆盖public void onBitmapFailed(Drawable errorDrawable {} @ Override public void onPrepareLoad(Drawable placeHolderDrawable){ }});
答案 0 :(得分:0)
搜索后,我发现数据来自字符串中的服务器,然后您首先必须将字符串解密为位图,然后在imageview中设置
答案 1 :(得分:0)
在onBitmapLoaded方法中,您可以使用
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom >from) {
Log.d("abhinav1", "onBitmapLoaded: "+bitmap);
r.setBackground(new BitmapDrawable(context.getResources(), bitmap));
}
请在Resources
构造函数中传递BitmapDrawable
。