美文网首页
Compose Column 滑动起来

Compose Column 滑动起来

作者: 菜鸟何时起飞 | 来源:发表于2021-09-04 23:28 被阅读0次
       val scrollState = rememberScrollState()
        Column(modifier = Modifier.fillMaxSize()) {
            BoxWithConstraints(modifier = Modifier.weight(1f)) {
                Surface {
                    Column(
                        modifier = Modifier
                            .fillMaxSize()
                            .verticalScroll(scrollState),
                    ) {
    
                        ProfileHeader(
                            actions.toAboutMe,
                            scrollState,
                            this@BoxWithConstraints.maxHeight
                        )
                        UserInfoFields(
                            actions.enterArticle,
                            actions.toLogin,
                            this@BoxWithConstraints.maxHeight
                        )
                    }
                }
                ProfileFab(
                    themeViewModel = themeViewModel,
                    extended = scrollState.value == 0,
                    modifier = Modifier.align(Alignment.BottomEnd)
                )
            }
        }
    

    1 column 增加verticalScroll 修饰 就可以滑动起来
    2 BoxWithConstraints 这个组件提供了获取 自己最大高度 与 最大宽度的方法

    相关文章

      网友评论

          本文标题:Compose Column 滑动起来

          本文链接:https://www.haomeiwen.com/subject/tmvdwltx.html