这是问题,毕加索默认可以加载Image Uri,File,drawable或string path。在下面的代码中,我的适配器设置如下:
public class RecyclerDataAdapter extends RecyclerView.Adapter<RecyclerDataAdapter.ViewHolder> {
public ArrayList<Bitmap> bitmapArray;
private Context context;
private Bitmap bmp;
public RecyclerDataAdapter(Context context, ArrayList<Bitmap> bm) {
this.bitmapArray = bm;
this.context = context;
}
@Override
public void onBindViewHolder(RecyclerDataAdapter.ViewHolder viewHolder, int i) {
Picasso.with(context).load(bitmapArray.get(i)).resize(240, 120).into(viewHolder.img_android);
}
}
我正在调用我的适配器:
RecyclerDataAdapter adapter = new RecyclerDataAdapter(getApplicationContext(),bitmapArray);
recyclerview.setAdapter(adapter);
基本上我的位图数组包含来自数据库的图像
Bitmap bitmap = BitmapFactory.decodeByteArray(ImageByte, 0, ImageByte.length, options);
bitmapArray.add(bitmap);
所以有人可以告诉我如何在picasso中将位图数组中的图像添加到.load中。提前谢谢!