Glide加载圆形、圆角图片
加载圆形图片:
RequestOptions mRequestOptions = RequestOptions.circleCropTransform()
.diskCacheStrategy(DiskCacheStrategy.NONE)//不做磁盘缓存
.skipMemoryCache(true);//不做内存缓存
Glide.with(mContext).load(userInfo.getImage()).apply(mRequestOptions).into(mUserIcon);
效果:
分割字符串加载图片
Glide.with(context).load(mlist.get(i).getImages().split("\|")[0].replace(“https”, “http”)).into(carShopViewHodler.mImage);
加载圆角图片
//设置图片圆角角度
RoundedCorners roundedCorners= new RoundedCorners(6);
//通过RequestOptions扩展功能,override:采样率,因为ImageView就这么大,可以压缩图片,降低内存消耗
RequestOptions options=RequestOptions.bitmapTransform(roundedCorners).override(300, 300);
Glide.with(context).load(files.getFilePath()).apply(options).into(mUserPhoto);
效果: