You can realize a modal bottom sheets using a [BottomSheetDialogFragment](<https://developer.android.com/reference/android/support/design/widget/BottomSheetDialogFragment.html>)
.
The [BottomSheetDialogFragment](<https://developer.android.com/reference/android/support/design/widget/BottomSheetDialogFragment.html>)
is a modal bottom sheet.
This is a version of DialogFragment
that shows a bottom sheet using BottomSheetDialog
instead of a floating dialog.
Just define the fragment:
public class MyBottomSheetDialogFragment extends BottomSheetDialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.my_fragment_bottom_sheet, container);
}
}
Then use this code to show the fragment:
MyBottomSheetDialogFragment mySheetDialog = new MyBottomSheetDialogFragment();
FragmentManager fm = getSupportFragmentManager();
mySheetDialog.show(fm, "modalSheetDialog");
This Fragment will create a [BottomSheetDialog](<http://stackoverflow.com/documentation/android/5702/bottom-sheets/20212/modal-bottom-sheets-with-bottomsheetdialog#t=201608301143536593245>)
.