Android中Glide的使用

Glide3升級到Glide4碰到的問題

(1)into

在Glide3.x中:

Bitmap bitmap = Glide.with(BaseApplication.getAppContext())
.load(url).asBitmap()
.into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
.get();

在Glide4.x中

Bitmap bitmap = Glide.with(BaseApplication.getAppContext()).asBitmap().load(url)
.apply(new RequestOptions().override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)).submit().get();

(2)bitmapTransform

在Glide3.x中:

Glide.with(XXXActivity.this).load("path").error(R.mipmap.zhan_error).bitmapTransform(new RoundedCornersTransformation(GeZiShowActivity.this, 13, 0,
RoundedCornersTransformation.CornerType.ALL)).into(imageView_show);

在Glide4.x中

RequestOptions myOptions = new RequestOptions().transform(new RoundedCornersTransformation(GeZiShowActivity.this,10,0,RoundedCornersTransformation.CornerType.ALL));
Glide.with(GeZiShowActivity.this).load("path").error(R.mipmap.zhan_error).apply(myOptions).into(imageView_show);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章