Card
属性
@Composable
@NonRestartableComposable
fun Card(
modifier: Modifier? = Modifier,
shape: Shape? = MaterialTheme.shapes.medium,
backgroundColor: Color? = MaterialTheme.colors.surface,
contentColor: Color? = contentColorFor(backgroundColor),
border: BorderStroke? = null,
elevation: Dp? = 1.dp,
content: (@Composable () -> Unit)?
): Unit
参数
- backgroudColor
- contentColor
- border
- elevation 抬高
@Composable
fun CardSample() {
Card(
modifier = Modifier.padding(8.dp),
backgroundColor = Color.Green,
contentColor = Color.White,
border = BorderStroke(1.dp, Color.Red),
elevation = 10.dp
) {
Text("Cart Content", Modifier.padding(8.dp), color = Color.Red)
}
}
视频教程
https://www.bilibili.com/video/BV1Gi4y127JL
实战视频