当使用自定义的圆形ImageView时,发现使用Glide加载并设置默认初始图片时,自定义的ImageView一直显示默认图片,无法更新到加载的图片。
使用下面代码可以解决这个问题
Glide.with(this).load(userInfo.getSmallIconUrl()) .placeholder(R.drawable.default_head) .into(new SimpleTarget<GlideDrawable>() { @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) { personalHead.setImageDrawable(resource); } });
即在Glide成功加载到图片资源时,手动将图片设置进ImageView中