到目前为止,我一直在使用CircleImageView。但现在我需要添加背景以及src。这两个功能都可在本机ImageView中使用。但是当我向CircleImageView添加背景颜色时,背景变为方形而不是圆形。我尝试了许多自定义圆形图像视图,但无济于事。有没有办法实现这个目标?
答案 0 :(得分:1)
使用github
中的这个RoundedImageView代码答案 1 :(得分:0)
使用普通imageview滑行检查我的代码:
Glide.with(getActivity()).load(dashBoardCompanyInfoModel.getLogo()).asBitmap().into(new BitmapImageViewTarget(ivProfile) {
@Override
protected void setResource(Bitmap resource) {
final RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(getResources(), resource);
circularBitmapDrawable.setCircular(true);
ivProfile.setImageDrawable(circularBitmapDrawable);
}
});