I was just wondering how to add margins to bottomsheetfragment using material 3 design like the new version of youtube app.
Here is the screenshot of the bottom sheet fragment that I want to implement bottom sheet example
I have already tried the solution from here Customization Bottom Sheet Dialog's View but it doesn't works correctly with material 3
Here is my bottom sheet fragment layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".utils.Bottom"\>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_48"
android:gravity="center_vertical"
android:text="Thhis is a bottom sheet"/>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_48"
android:gravity="center_vertical"
android:text="Thhis is a bottom sheet"/>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_48"
android:gravity="center_vertical"
android:text="Thhis is a bottom sheet"/>
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_48"
android:gravity="center_vertical"
android:text="Thhis is a bottom sheet"/>
Here is my bottom sheet fragment class:
class BottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val view = View.inflate(context,R.layout.fragment_bottom,null)
return view
}
}
What should I do to replicate the bottom sheet like the screenshot above?