【发布时间】:2023-02-03 07:50:01
【问题描述】:
我正在使用新的 AysncImage 加载程序在 Box 中进行组合。 Box 本身有一个 RoundedCornerShape。我还为具有以下值的 AsyncImage 添加了一个 RoundedCornerShape
Box(
modifier = modifier
.clip(RoundedCornerShape(16.dp))
) {
AsyncImage(
modifier = Modifier
.height(146.dp)
.clip(shape = RoundedCornerShape(
topStart = 16.dp,
topEnd = 16.dp,
bottomStart = 0.dp,
bottomEnd = 0.dp))
,
model = R.drawable.image,
contentDescription = null,
contentScale = ContentScale.Crop,
)
}
但是图像的各个角落都是圆形的。 Screen Shot here
我不希望图像底部有圆角。
【问题讨论】:
-
为什么你的外箱上有
clip(RoundedCornerShape(16.dp))?这不是要在每个角落剪掉你的AsyncImage,不管你给你的AsyncImage加上什么修饰符吗? -
正如#ianhanniballake 所说,只需删除 AsyncImage(...) 修饰符上的剪辑,因为框会自动剪辑您的图像
-
@ianhanniballake 移除了盒子夹,它做了我想要的,谢谢
标签: android android-jetpack-compose android-jetpack coil