我想知道jetpack中的Scaffold是什么,并带有BottomAppBar示例,任何人都可以帮助我
Scaffold
user14938758
问问题
4320 次
1 回答
19
With1.0.x
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 ->
//....
}
)
于 2021-03-27T08:50:04.933 回答