Android系统自带圆形图片实现

在Glide中加载本地圆形图片时会有问题,所以这里换了其他方式
代码如下:

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.head);
RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
//roundedBitmapDrawable.setCornerRadius(100);//圆角角度自行调整
roundedBitmapDrawable.setCircular(true);//设置为圆形图片

参考链接:

  1. https://www.jianshu.com/p/ed42d8c90a45
  2. https://my.oschina.net/xesam/blog/529305?p={{currentpage+1}}
  3. https://yq.aliyun.com/articles/615956
发布了132 篇原创文章 · 获赞 29 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/Mr_Tony/article/details/103937868