ByteArrayOutputStream baos = new ByteArrayOutputStream();
Bitmap bitmap = BitmapUtils.getBitmapFromBytes(bytes);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
byte[] bitmapBytes = baos.toByteArray();
Glide.with(getActivity())
.load(bitmapBytes)
.placeholder(R.mipmap.mine_people)
.dontAnimate()
.into(img_head);
Glide加载byte数组
本文介绍了一种使用Glide加载PNG格式图片的方法。通过将字节数组转换为Bitmap对象,并压缩为指定格式,最终利用Glide显示到ImageView中。此过程包括了创建ByteArrayOutputStream对象、使用BitmapUtils获取Bitmap、压缩Bitmap并将其转换回字节数组等步骤。

被折叠的 条评论
为什么被折叠?



