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?
How to add border to card view with jetpack compose
44.1k views Asked by ccd At
2
There are 2 answers
0
On
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.