BottomSheetDialogFragment is not open, small white bar only show

Viewed 712

I have created BottomSheetDialogFragment and access into my fragment but it not open fully, it shows only small bar in bottom like below

enter image description here

I am using default BottomSheetDialogFragment file without changing anything.

xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    android:paddingTop="@dimen/list_item_spacing_half"
    android:paddingBottom="@dimen/list_item_spacing_half"
    tools:context=".ui.SettingFragment"
    tools:listitem="@layout/fragment_setting_list_dialog_item" />

Show call function

val addBottomDialogFragment: SettingFragment = SettingFragment.newInstance(10)

addBottomDialogFragment.show(supportFragmentManager, "tag")
3 Answers

Because your BottomSheet don't have content, You have to add content to it

Height of BottomSheet depend on child content height So first you should add some child view or content under bottom sheet view. If you using RecyclerView then set adapter with data.

Your bottom sheet root element should be "Linear Layout" or "Relative Layout" set background to Transparent.

Related