[英]Divider in compose material 3
I want to add a horizontal divider below the top bar like this:我想在顶部栏下方添加一个水平分隔线,如下所示:
I am using Material 3. but the Divider can not be resolved.我正在使用材料 3。但无法解决分隔线。 here are my dependencies:这是我的依赖项:
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation 'androidx.compose.material3:material3:1.0.0-alpha01'
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}
And here are my codes:这是我的代码:
Scaffold(
topBar = {
SmallTopAppBar(
navigationIcon = {
IconButton(
onClick = {}) {
Icon(
imageVector = Icons.Default.ArrowBack,
contentDescription = "Back",
tint = Color.Black
)
}
},
title = {
Text(
text = "",
color = MaterialTheme.colorScheme.onPrimary
)
},
)
}
) {
Box {
Divider(color = Color.Gray, thickness = 1.dp)
}
}
But as I mentioned above Divider is the unresolved reference:但正如我上面提到的 Divider 是未解决的参考:
Please upgrade to:请升级到:
implementation 'androidx.compose.material3:material3:1.0.0-alpha15'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.