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);
本文详细对比了Glide3与Glide4在图片加载及转换上的API变化,包括into方法与bitmapTransform的使用差异,为开发者提供从Glide3平滑过渡到Glide4的实践指南。
814

被折叠的 条评论
为什么被折叠?



