3

I work with BottomSheetDialog, and some difficulties have occurred. I want to remove the background of the black background, and change it to transparency. I tried this BottomSheetDialog with transparent background , but it did not work out. Help me.

[enter image description here][1]

code is:

BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(getActivity());
    View parentView = getLayoutInflater().inflate(R.layout.content_status_dialog,null);
    bottomSheetDialog.setContentView(parentView);
    BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View)parentView.getParent());
    bottomSheetDialog.setCancelable(true);
    bottomSheetBehavior.setPeekHeight((int)TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP,100,
            getResources().getDisplayMetrics()));

    bottomSheetDialog.show();

If I add some style like this

 ((View) getView().getParent()).setBackgroundColor(Color.TRANSPARENT);

, it will look like this

Mukhit
  • 152
  • 2
  • 10

1 Answers1

6

The only thing that needs to be done is by adding this line:

if(bottomSheetDialog.getWindow() != null)
bottomSheetDialog.getWindow().setDimAmount(0);

before

bottomSheetDialog.show();
Marsad
  • 859
  • 1
  • 14
  • 35