关于Glide加载Bitmap的问题

需要先将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);

你可能感兴趣的:(关于Glide加载Bitmap的问题)