在Glide中加载本地圆形图片时会有问题,所以这里换了其他方式
代码如下:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.head);
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
//roundedBitmapDrawable.setCornerRadius(100);//圆角角度自行调整
roundedBitmapDrawable.setCircular(true);//设置为圆形图片
参考链接:
- https://www.jianshu.com/p/ed42d8c90a45
- https://my.oschina.net/xesam/blog/529305?p={{currentpage+1}}
- https://yq.aliyun.com/articles/615956