什么是脚手架?喷气背包组合

时间:2021-03-27 05:04:32

标签: android android-jetpack-compose android-bottomappbar android-jetpack-compose-scaffold

我想知道喷气背包中的 Scaffold 是什么,有一个BottomAppBar 的例子,谁能帮我 Scaffold

1 个答案:

答案 0 :(得分:1)

使用 1.0.0(使用 1.0.0-beta07 测试)Scaffold 允许您实现具有基本 Material Design 布局结构的 UI。 Scaffold 为最常见的顶级 Material 组件提供插槽,例如 TopAppBarBottomAppBarFloatingActionButtonDrawer

类似于:

   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 ->
            //....
        }
    )

enter image description here