How to smooth background when using BottomSheet from the support library?

How can the background be darkened as shown here ?

I installed it normally using CoordinatorLayout and BottomSheetBehavior .

+7
android android-coordinatorlayout androiddesignsupport bottom-sheet
source share
2 answers

This will just show the bottom sheet.

 public class MyBottomSheet extends BottomSheetDialogFragment { private static final String TAG = "MyBottomSheet"; @NonNull @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); final View view = View.inflate(getContext(), R.layout.my_custom_view, null); dialog.setContentView(view); behavior = BottomSheetBehavior.from((View) view.getParent()); return dialog; } public void show(final FragmentActivity fragmentActivity) { show(fragmentActivity.getSupportFragmentManager(), TAG); } } 

To close the dialog is just like a regular call to close() .

+4
source share

use BottomSheetDialog

basically it is a dialogue (i.e. dull) and support for the modal behavior of the bottom sheets give it a try

0
source share

All Articles