![](/img/trans.png)
[英]Modal Bottom Sheet scrim color is not shown in status bar in Jetpack compose
[英]Jetpack compose - change bottom bar cutout color
如何更改底部栏的切口颜色?
我知道它采用MaterialTheme.colors.background
的颜色,但我不想更改所有组件的背景颜色,仅更改底部栏的背景颜色。 (图中剪下的白色。)
我尝试了不同的方法,例如只为底部栏设置一个新主题,但这不起作用。
val bottomBarColors = MaterialTheme.colors.copy(background = Color.LightGray)
...
bottomBar = {
MaterialTheme(
colors = bottomBarColors,
typography = MaterialTheme.typography,
shapes = MaterialTheme.shapes
) {
BottomAppBar(
cutoutShape = fabShape,
content = {
MyBottomNavigation(navController, bottomNavigationItems)
})
}
}
解决方案比我想象的要容易。 只需在底部栏下方添加一些内容:
bottomBar = {
Box {
Spacer(modifier = Modifier.matchParentSize().background(color = Color.Blue))
BottomAppBar(
cutoutShape = fabShape,
content = {
MyBottomNavigation(navController, bottomNavigationItems)
})
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.