如何使用 Picasso 库仅从底部剪切图像
how to use Picasso library to cut the image from bottom only
我正在使用以下代码将图像加载到 imageView.I 中,只想从底部剪切图像。我如何使用 Picasso 尝试中心裁剪和从顶部和底部剪切的图像
Picasso.with(getContext())
.load(imageUrl)
.fit()
.into(imageView);
使用变换,您可以根据重力裁剪图像。
Picasso.with(mContext)
.load(imageUrl)
.transform(new CropTransformation(500,150), CropTransformation.GravityHorizontal.CENTER, CropTransformation.GravityVertical.TOP))
.into(imageView);
以上代码只会从底部剪切图像。
您可以获得 CropTransformation 库 here。
试试这个 .centerCrop(Gravity.TOP)
Picasso.get()
.load(GlobalApplication.BaseUrl +"/" + item.AD_THUMBNAIL)
.resize(180, 145)
.centerCrop(Gravity.TOP)
.into(holder.imgAd);
我正在使用以下代码将图像加载到 imageView.I 中,只想从底部剪切图像。我如何使用 Picasso 尝试中心裁剪和从顶部和底部剪切的图像
Picasso.with(getContext())
.load(imageUrl)
.fit()
.into(imageView);
使用变换,您可以根据重力裁剪图像。
Picasso.with(mContext)
.load(imageUrl)
.transform(new CropTransformation(500,150), CropTransformation.GravityHorizontal.CENTER, CropTransformation.GravityVertical.TOP))
.into(imageView);
以上代码只会从底部剪切图像。
您可以获得 CropTransformation 库 here。
试试这个 .centerCrop(Gravity.TOP)
Picasso.get()
.load(GlobalApplication.BaseUrl +"/" + item.AD_THUMBNAIL)
.resize(180, 145)
.centerCrop(Gravity.TOP)
.into(holder.imgAd);