需要先将bitmap对象转换为字节,在加载;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
byte[] bytes=baos.toByteArray();
Glide.with(mContext)
.load(bytes)
.centerCrop()
// .thumbnail(0.1f) //缩略图为原来的十分之一
.override(Utils.px2dip(mContext,130),Utils.px2dip(mContext,130)) //设置大小
.placeholder(me.iwf.photopicker.R.drawable.__picker_ic_photo_black_48dp)
.error(me.iwf.photopicker.R.drawable.__picker_ic_broken_image_black_48dp)
.into(holder.ivPhoto);
网友评论