How to round an image with Glide library?

前端 未结 22 1799
悲哀的现实
悲哀的现实 2020-11-28 00:46

So, anybody know how to display an image with rounded corners with Glide? I am loading an image with Glide, but I don\'t know how to pass rounded params to this library.

22条回答
  •  眼角桃花
    2020-11-28 01:19

    Try this way

    code

    Glide.with(this)
        .load(R.drawable.thumbnail)
        .bitmapTransform(new CropCircleTransformation(this))
        .into(mProfile);
    

    XML

    
    

    all_circle_white_bg.xml

    
    
      
        
          
      
      
    
    
    • I use this transformation library. -> https://github.com/wasabeef/glide-transformations
    • Circle stroke width is ImageView's padding

提交回复
热议问题