我想知道Jetpack Compose中的Scaffold是什么,有一个带BottomAppBar的例子可以吗?请问有人能够帮忙吗?Scaffold
我想知道Jetpack Compose中的Scaffold是什么,有一个带BottomAppBar的例子可以吗?请问有人能够帮忙吗?Scaffold
Scaffold
允许您使用基本的Material Design布局结构实现UI。 Scaffold
为最常见的顶级Material组件(例如TopAppBar
, BottomAppBar
, FloatingActionButton
和Drawer
)提供插槽。
类似于:
val scaffoldState = rememberScaffoldState()
// Create a coroutineScope for the animation
val coroutineScope = rememberCoroutineScope()
Scaffold(
scaffoldState = scaffoldState,
drawerContent = { Text("Drawer content") },
bottomBar = {
BottomAppBar(cutoutShape = CircleShape) {
IconButton(
onClick = {
coroutineScope.launch { scaffoldState.drawerState.open() }
}
) {
Icon(Icons.Filled.Menu, contentDescription = "....")
}
}
},
floatingActionButton = {
ExtendedFloatingActionButton(
text = { Text("Action") },
onClick = { /* .... */ }
)
},
floatingActionButtonPosition = FabPosition.Center,
isFloatingActionButtonDocked = true,
content = { innerPadding ->
//....
}
)