

fragment_item_list_dialog.xml: this is a layout of recycler view in the bottom sheet fragment (Also the layout of bottom sheet fragment) // you can change this file to change the layout of bottom sheet fragment.ItemListDialogFragment: this is a java class which can render the recycler view and bottom sheet fragment.

Next, we generate the bottom sheet fragment template from android studio by clicking File -> New -> Fragment -> Modal Bottom SheetĪfter click the Modal Bottom Sheet, android studio will automatically generate three files for you, show as below:

The result of this example is popping up a bottom sheet after click the button in the main activity.įirstly, we can create the main activity as below witch a button to call the bottom sheet and a text view to show the result after clicking the item in the bottom sheet: 1 I will give you an example to explain the bottom sheet fragment template generated from android studio.
