提问人:Cam 提问时间:8/27/2023 更新时间:8/27/2023 访问量:57
“持久底部表”对话框
Persistent Bottomsheet Dialog
问:
我有一个包含持久底部工作表对话框的片段,但我已经在我的项目中使用了视图绑定和数据绑定,所以当我声明底部工作表行为时,当我声明时
BottomSheetBehavior.from(binding.bottom_sheet)
它说未解析的参考:bottom_sheet
.将持久性底表与视图绑定和数据绑定一起使用是否不合适?
这是我bottom_sheet.xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bottom_round_corner"
app:behavior_hideable="true"
app:behavior_peekHeight="56dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
这是我的片段,包含底层
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".testscreen.MainFragment">
<androidx.constraintlayout.widget.ConstraintLayout>
...
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/fragment_bottom_sheet"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
我试图在包含它的片段中指定底层工作表的 ID,但它根本不起作用
<include layout="@layout/fragment_bottom_sheet" android:id="@+id/bottom_sheet"/>
答: 暂无答案
评论