【问题标题】:How to configure HalfExpanded value in ModalBottomSheetLayout - Jetpack Compose如何在 ModalBottomSheetLayout - Jetpack Compose 中配置 HalfExpanded 值
【发布时间】:2023-01-12 21:52:47
【问题描述】:

我只想在HalfExpandedModalBottomSheetLayout 的状态下显示我的工作表的 30% 而不是 50%。我怎样才能做到这一点?

【问题讨论】:

    标签: android android-jetpack-compose material-components-android


    【解决方案1】:

    您可以通过将 Modifier 传递给定义该状态下工作表所需高度的 ModalBottomSheetLayout 来配置 HalfExpanded 状态。

    ModalBottomSheetLayout(
        state = state,
        sheetContent = { /* content */ },
        sheetPeekHeight = Modifier.preferredHeight(height)
    )
    

    height in dp(可以从屏幕高度算出30%的高度)

    【讨论】:

      猜你喜欢
      • 2022-07-07
      • 1970-01-01
      • 1970-01-01
      • 2022-10-23
      • 1970-01-01
      • 2022-10-16
      • 1970-01-01
      • 2023-01-03
      • 2023-02-26
      相关资源
      最近更新 更多