我正在使用 Glide 4.3.0
和 wasabeef/glide-transformations 来为我的图像视图添加左下角和右下角的圆角。图像已经加载,但是转换没有应用,我看不到任何角落的变化。
这是我的 Glide 转换:
Glide.with(context)
.load(message.imageUrl)
.apply(bitmapTransform(new RoundedCornersTransformation(25, 0, RoundedCornersTransformation.CornerType.BOTTOM)))
.into(aq.id(R.id.ivSingleImage).getImageView());
我的导入如下:
import com.bumptech.glide.Glide;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import static com.bumptech.glide.request.RequestOptions.bitmapTransform;
图片已加载但未应用任何转换。这个实现是否正确?
我还尝试了 Bottom_left 和 Bottom_right。
编辑:
我注意到只有在 scaleType 设置为 centerCrop 时才会出现这种情况。如果我从 XML 中删除它,它就能正常工作,但是图像左右两侧会留下两个大的空白间隔。
<ImageView
android:id="@+id/ivSingleImage"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="@color/white"
android:scaleType="centerCrop" <!--Removing this works. But leaves two spaces on left and right sides-->
android:layout_marginEnd="5dp" />
关于更新,如何让图片进行centerCrop操作并仍然进行圆角处理?