Я получаю исключение при попытке установить состояние «Расширяемый» в нижнем диалоговом окне.
java .lang.IllegalArgumentException: представление не является дочерним по отношению к CoordinatorLayout
Я хочу установить состояние диалогового окна нижнего листа, и я делаю
val sheetView = layoutInflater.inflate(R.layout.filter_bottom_sheet_layout, null)
setContentView(sheetView)
BottomSheetBehavior.from(sheetView).peekHeight =
Resources.getSystem().getDisplayMetrics().heightPixels
BottomSheetBehavior.from(sheetView).state = BottomSheetBehavior.STATE_EXPANDED
Ниже XML. Кто-нибудь может подсказать, что здесь происходит? Пожалуйста, дайте мне знать, если кому-то нужно увидеть дополнительный фрагмент кода
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.xyz.FilterBaseLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/rounded_white_only_top"
android:maxHeight="500dp"
style="?attr/bottomSheetStyle"
android:orientation="vertical"
app:layout_behavior="@string/bottom_sheet_behavior">
<com.base.components.ui.BaseTextView
android:id="@+id/resetFilter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:lineSpacingExtra="6sp"
android:minHeight="36dp"
android:padding="@dimen/dp_15"
android:text="@string/reset"
android:textAllCaps="true"
android:textColor="#995ea6"
android:textSize="16sp"
android:textStyle="bold">
</com.base.components.ui.BaseTextView>
<com.base.components.ui.BaseTextView
android:id="@+id/filterDone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="center"
android:lineSpacingExtra="6sp"
android:minHeight="36dp"
android:padding="@dimen/dp_15"
android:text="@string/done"
android:textAllCaps="true"
android:textColor="#f4246d"
android:textSize="16sp"
android:textStyle="bold">
</com.base.components.ui.BaseTextView>
<LinearLayout
android:id="@+id/border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/resetFilter"
android:background="@color/grey_light_bg"
android:orientation="vertical">
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerviewFilter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/border"
android:layout_gravity="bottom"
android:background="@color/white"
android:clipToPadding="false"
android:paddingLeft="@dimen/dp_15"
android:paddingRight="@dimen/dp_15" />
</com.xyz.FilterBaseLayout>