How to remove the shadow created by bottom sheet dialog fragment in android?

Viewed 2122

I have created a modal bottom sheet dialog fragment but it covers the full screen with the shadow or transparent black color when it expands.

How do I remove that shadow from the bottom-sheet fragment?

1 Answers

Try my code below:

1. Create a bottom sheet style in style.xml

<style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="android:backgroundDimAmount">0</item>
</style>

2. Add your style to onCreate function on your BottomSheetDialogFragment

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(STYLE_NORMAL, R.style.BottomSheetDialog);
}

Hope that help :)

Related