Android Jetpack组合脚手架&x2B;模态底片
我正在尝试使用Compose设计一个布局,其中包括:Android Jetpack组合脚手架&x2B;模态底片,android,android-jetpack-compose,Android,Android Jetpack Compose,我正在尝试使用Compose设计一个布局,其中包括: TopAppBar 正文(内容) 底部压条 单击时表示菜单的底部工作表(模式底部工作表) -------TopAppBar------- ------主要内容------ ------底部压条----- ----模型底板--- Compose提供3个组件: 脚手架 底板脚手架 ModalBottomSheet布局 脚手架没有底部板材属性 BottomSheetScaffold没有BottomAppBar属性 ModalBottomSheetL
我应该组合这些组件中的哪一个以及以何种**结构**来实现我想要的?
脚手架(
topBar={topBar()},
内容={innerPadding->Body(innerPadding)},
bottomAppbar={bottomAppbar()}
)
ModalBottomSheet布局(
sheetState=RememberModerBottomSheetState(
initialValue=ModalBottomSheetValue.Hidden
),
sheetContent={sheetContent()},
)
底板脚手架(
脚手架状态=。。。,
sheetContent={sheetContent()},
内容={ScreenContent()},
)
您可以使用以下内容:
val bottomState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)
ModalBottomSheetLayout(
sheetState = bottomState,
sheetContent = {
//. sheetContent
}
) {
Scaffold(
scaffoldState = scaffoldState,
topBar = {
TopAppBar(
title = {
Text(text = "TopAppBar")
}
)
},
bottomBar = {
BottomAppBar(modifier = Modifier) {
IconButton(
onClick = {
coroutineScope.launch { bottomState.show() }
}
) {
Icon(Icons.Filled.Menu, contentDescription = "Localized description")
}
}
},
content = { innerPadding ->
//...main content
}
)
}
您可以使用以下内容:
val bottomState = rememberModalBottomSheetState(ModalBottomSheetValue.Hidden)
ModalBottomSheetLayout(
sheetState = bottomState,
sheetContent = {
//. sheetContent
}
) {
Scaffold(
scaffoldState = scaffoldState,
topBar = {
TopAppBar(
title = {
Text(text = "TopAppBar")
}
)
},
bottomBar = {
BottomAppBar(modifier = Modifier) {
IconButton(
onClick = {
coroutineScope.launch { bottomState.show() }
}
) {
Icon(Icons.Filled.Menu, contentDescription = "Localized description")
}
}
},
content = { innerPadding ->
//...main content
}
)
}