[英]Card element with shadow only on the bottom
I am trying to create Card element and to add shadow only on bottom part with a little bit in left and right and zero on the top.我正在尝试创建 Card 元素并仅在底部添加阴影,左右各有一点,顶部为零。
Card(
elevation = 10.dp,
modifier = Modifier
.background(color = seatfrogWhite, shape = RoundedCornerShape(4.dp))
.graphicsLayer {
this.shadowElevation = 10.dp.toPx()
this.shape = RoundedCornerShape(4.dp)
this.clip = true
}
.height(50.dp)
.width(100.dp),
shape = RoundedCornerShape(4.dp)
) {}
I have tried with shadow()
modifier, but without success.我试过使用
shadow()
修饰符,但没有成功。 It always add shadow on the top.它总是在顶部添加阴影。
You can use the M3 ElevatedCard
:您可以使用 M3
ElevatedCard
:
ElevatedCard(
Modifier.size(width = 180.dp, height = 50.dp),
shape = RoundedCornerShape(4.dp),
elevation = CardDefaults.elevatedCardElevation(8.dp),
colors = CardDefaults.elevatedCardColors(containerColor = Teal200),
) {
// Card content
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.