【问题标题】:BottomSheetBehavior in AndroidXAndroidX 中的 BottomSheetBehavior
【发布时间】:2019-05-05 12:44:26
【问题描述】:

我之前使用的是 android.support.design.widget.BottomSheetBehavior,现在 AndroidX 不可用,有人建议使用 com.google.android。 material.bottomsheet.BottomSheetBehavior(参见此链接BottomSheetBehavior not in androidX libraries),但它与 NestedScrollView 存在一些错误和冲突,有时它不会将拖动传递给 NestedScrollView。 是否有任何 AndroidX 替代品,而不是谷歌材料的?

我检查了来自 Google 的以下链接,但没有找到 android.support.design.widget.BottomSheetBehavior 的替代品:https://developer.android.com/jetpack/androidx/migrate

【问题讨论】:

  • android pie 支持库已经上线,你可以同时继续使用

标签: android androidx bottom-sheet material-components-android material-components


【解决方案1】:

你可以使用

app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"

而不是

app:layout_behavior="android.support.design.widget.BottomSheetBehavior"

【讨论】:

    【解决方案2】:

    新组件位于Material Components library 内。

    使用这个类:

    com.google.android.material.bottomsheet.BottomSheetBehavior
    

    还有:

    【讨论】:

      猜你喜欢
      • 2019-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多