我是 Android Jetpack Compose 的新手,尝试使用 Column 创建按钮列表,但应用程序因抛出错误而崩溃
无法启动活动 ComponentInfo{com.sample.composeUI/com.sample.composeUI.ui.homeScreen.HomeScreenActivity}:java.lang.IllegalStateException:未找到颜色!
代码:
@Composable
fun homeScreenCompose() {
Column(
crossAxisAlignment = CrossAxisAlignment.Center,
mainAxisAlignment = MainAxisAlignment.Center,
modifier = Spacing(16.dp)
) {
Button(
text = "ListView", onClick = {
}, style = ContainedButtonStyle(
color = Color.White,
shape = RectangleShape,
rippleColor = Color.DarkGray,
elevation = Dp(4f)
))
}
}
无法找到此问题的路径原因,我们将不胜感激。