问题
在使用 Glide 的过程中,出现图片加载的时候,在第一次加载的时候,就只会显示 placeholder 的图片。
具体场景
在评论中显示用户的头像,我使用得是第三方的CircleImageView,之后也替换成SDK提供的内置的CircleImageView,发现都是有这个问题的。
解决
最终,我使用了最初的 ImageView,而圆形的问题使用 Glide BitmapTransForm 解决了。
compile 'jp.wasabeef:glide-transformations:2.0.1'
Glide.with(mContext)
.load(CommonUtils.getImageUrlByName(url)
.crossFade()
.centerCrop()
.bitmapTransform(new CropCircleTransformation(mContext))
.placeholder(R.drawable.default_user_red)
.into(holder.mAvatar);
本文介绍了解决Glide加载圆形头像时只显示占位图的问题。通过使用GlideBitmapTransForm库并结合自定义转换实现圆形裁剪,成功在ImageView中正确展示头像。
865

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



