我想显示顶部栏下方但底部栏上方的NavigationDrawer.
以下是我到目前为止实现的内容.目前,它显示在顶栏下方,也显示在底部栏下方.
@Composable
fun MainScreen() {
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
val scope = rememberCoroutineScope()
Scaffold(
topBar = {
MyTopAppBar {
scope.launch {
drawerState.open()
}
}
},
bottomBar = {
MyBottomAppBar(modifier = Modifier.height(65.dp)) {
val modifier = Modifier
.weight(1f)
.fillMaxHeight();
BottomAppBarItem(
"Calls",
Icons.Filled.Call,
false,
modifier
)
BottomAppBarItem(
"Search",
Icons.Filled.Search,
true,
modifier
)
BottomAppBarItem(
"Contacts",
Icons.Filled.AccountBox,
false,
modifier
)
}
}
) { paddingValues ->
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues),
color = MaterialTheme.colorScheme.background
) {
ModalNavigationDrawer(gesturesEnabled = true, drawerContent = {
DrawerContent()
}, drawerState = drawerState) {
}
}
}
}