I find the way Border(1.dp, Color.Black) can not work with the border property of Card view, what's the best way to work around of it?
I find the way Border(1.dp, Color.Black) can not work with the border property of Card view, what's the best way to work around of it?
You can use the border parameter to specify a BorderStroke to draw the border on top of the card:
Card(
border = BorderStroke(2.dp,Color.Red),
backgroundColor = Color.Yellow){
}
With Material3 you can use:
Card(
border = BorderStroke(2.dp,Color.Red),
colors = CardDefaults.cardColors(containerColor = Yellow)
)
The border api of Card change to subtitle of Modifier, so it can add a border under below.
Card(modifier = Modifier.border(1.dp, Color.Black)) {...}