gpt4 book ai didi

android - Jetpack Compose BottomNavBar 吗?如何使用 bottomNavbar 任何示例?

转载 作者:行者123 更新时间:2023-12-01 11:12:21 25 4
gpt4 key购买 nike

我正在处理 jectpack compose在安卓应用程序中。所以我想使用 bottomAppbar .从来没有找到任何例子有人可以帮忙吗?

最佳答案

1.0.x您可以使用 BottomAppBar

BottomAppBar (backgroundColor = yellow500) {
IconButton(onClick = { /* doSomething() */ }) {
Icon(Icons.Filled.Menu,"")
}
// The actions should be at the end of the BottomAppBar
Spacer(Modifier.weight(1f, true))
IconButton(onClick = { /* doSomething() */ }) {
Icon(Icons.Filled.Favorite,"")
}
IconButton(onClick = { /* doSomething() */ }) {
Icon(Icons.Filled.Call,"")
}
}
enter image description here
使用 FAB:
val fabShape = CircleShape
val scaffoldState = rememberScaffoldState()
val scope = rememberCoroutineScope()

Scaffold(
scaffoldState = scaffoldState,
drawerContent = { Text("Drawer content") },
topBar = { },
bottomBar = {
BottomAppBar(cutoutShape = fabShape) {
IconButton(
onClick = {
scope.launch { scaffoldState.drawerState.open() }
}
) {
Icon(Icons.Filled.Menu,"")
}
}
},
floatingActionButtonPosition = FabPosition.Center,
isFloatingActionButtonDocked = true,
floatingActionButton = {
FloatingActionButton(
shape = fabShape,
onClick = {}
) {
Icon(Icons.Filled.Add,"")
}
}, content = {
//bodyContent()
})
enter image description here

关于android - Jetpack Compose BottomNavBar 吗?如何使用 bottomNavbar 任何示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58574274/

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