仅在图像顶部有圆角 AysncImage Coil

Soh*_*hah 7 android android-jetpack android-jetpack-compose coil

我正在使用新的 AysncImage 加载器在 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,
            )
        }
Run Code Online (Sandbox Code Playgroud)

但图像的各个角落都是圆角的。屏幕截图在这里

我不希望图像底部有圆角。

小智 13

将此修饰符添加到您的 AsyncImage

 modifier = Modifier.clip(RoundedCornerShape(topEnd = 8.dp , topStart = 8.dp))
Run Code Online (Sandbox Code Playgroud)