Glide 圆角+居中裁剪centerCrop冲突问题
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                Glide 圆角+居中裁剪centerCrop冲突问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                RequestOptions 源碼:
public RequestOptions centerCrop() {return transform(DownsampleStrategy.CENTER_OUTSIDE, new CenterCrop());}public RequestOptions transform(@NonNull Transformation<Bitmap> transformation) {return transform(transformation, /*isRequired=*/ true);}centerCrop本質也是調用transform,同時設置,會有一個被覆蓋失去效果。
解決:
Glide.with(this@CheckRecordActivity).load(AppConfig.HOST_PIC + item.fileInfo?.id).apply(RequestOptions().apply {placeholder(R.mipmap.check_record_item_default)error(R.mipmap.check_record_item_default)diskCacheStrategy(DiskCacheStrategy.NONE)skipMemoryCache(true)withCrossFade()transform(MultiTransformation(CenterCrop(), RoundedCorners(20)))}).into(holder.getView(R.id.iv_check_record))核心: transform(MultiTransformation(CenterCrop(), RoundedCorners(20)))
即 : 圓角和CenterCrop 同時設置生效
總結
以上是生活随笔為你收集整理的Glide 圆角+居中裁剪centerCrop冲突问题的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 19什么情况下会帮助他人
 - 下一篇: shields 徽标_我的徽标素描过程