Glide裁剪图片、边框的用法

 

        RequestOptions options = RequestOptions.bitmapTransform(new CircleCrop());
        Glide.with(edu_attention_item_img)
                .load("url")
                .error(res)
                .placeholder(res).apply(options).into(img);
 RoundedCorners roundedCorners = new RoundedCorners(ScreenUtil.dip2px(4));//数字为圆角度数
        RequestOptions coverRequestOptions = new RequestOptions()
                .transforms(new CenterCrop(),roundedCorners)
                .diskCacheStrategy(DiskCacheStrategy.ALL)//不做磁盘缓存
                .skipMemoryCache(true);//不做内存缓存
        Glide.with(mContext)
                .asBitmap()
                .load(url)
                .apply(coverRequestOptions)
                .into(img);

 

你可能感兴趣的:(开发代码)