Glide.with(getContext()).load(userImg).asBitmap().centerCrop().placeholder(R.drawable.ic_placeholder_avatar).centerCrop().into(new BitmapImageViewTarget(mIcon) {
????????@Override
????????????protected void setResource(Bitmap resource) {
????????????????????????RoundedBitmapDrawable circularBitmapDrawable =
????????????????????????????????RoundedBitmapDrawableFactory.create(getContext().getResources(), resource);
????????????????????????circularBitmapDrawable.setCircular(true);
????????????????????????mIcon.setImageDrawable(circularBitmapDrawable);
????????}
});
說明:1秀仲、如果是網(wǎng)絡(luò)獲取地址,想顯示圓形圖片炬搭,直接復(fù)制上方代碼即可。
???????????2纲缓、如果直接是bitmap吼鳞,直接復(fù)制重寫方法里的代碼即可。
???????????3检诗、如果glide未顯示圖片,是否考慮一下Glide.clear(View)瓢剿。
???????????4逢慌、我是小白,大神勿噴