我想知道jetpack中的Scaffold是什么,用BottomAppBar示例编写,有人能帮我吗Scaffold
Scaffold
sr4lhrrt1#
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 -> //.... } )
1条答案
按热度按时间sr4lhrrt1#
Scaffold
**允许您使用基本Material Design布局结构实现UI。Scaffold
为最常用的顶级Material组件(如TopAppBar
、BottomAppBar
、FloatingActionButton
和Drawer
)提供插槽。比如: