gpt4 book ai didi

android - 合成 Material 3 中的分隔符

转载 作者:行者123 更新时间:2023-12-02 18:06:18 33 4
gpt4 key购买 nike

我想在顶栏下方添加一个水平分隔线,如下所示:

enter image description here

我使用的是 Material 3,但无法解析分隔线。这是我的依赖项:

 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"
}

这是我的代码:

 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)

}

}

但正如我上面提到的 Divider 是 Unresolved reference :

enter image description here

最佳答案

请升级到:

    implementation 'androidx.compose.material3:material3:1.0.0-alpha15'

关于android - 合成 Material 3 中的分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73192786/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com