什么是脚手架? Jetpack 撰写
What is Scaffold? Jetpack compose
我想知道什么是 Jetpack 中的 Scaffold compose with a BottomAppBar example 任何人都可以帮助我
Scaffold
Scaffold
允许您使用基本的 Material 设计布局结构实现 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 ->
//....
}
)
我想知道什么是 Jetpack 中的 Scaffold compose with a BottomAppBar example 任何人都可以帮助我
Scaffold
Scaffold
允许您使用基本的 Material 设计布局结构实现 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 ->
//....
}
)