Glide设置圆形图片

时间:2025-01-27 12:50:13

导入依赖

 implementation ':glide:4.6.1' 

用Glide加载圆形图片

(context).load((position).getImgsrc())
                .apply((new CircleCrop()))
                .into();

导入依赖

  compile ':glide:3.7.0'

代码

 (getContext()).load("/uploadpic/2014-09-12/").asBitmap().centerCrop().into(new BitmapImageViewTarget(iv_user_head) {
        @Override
        protected void setResource(Bitmap resource) {
            RoundedBitmapDrawable circularBitmapDrawable = (getContext().getResources(), resource);
            (true);
            iv_user_head.setImageDrawable(circularBitmapDrawable);
        }
    });

glide设置四个角弧度

	 //设置图片圆角角度
	   RoundedCorners roundedCorners= new RoundedCorners(10);
	   //通过RequestOptions扩展功能
	  RequestOptions options=(roundedCorners);	    
	  (context).load(()).apply(options).into(product_img);