How can I make the corners of my bottom sheet dialog rounded?

Tags: , , ,

I’m trying to make the top corners of my BottomSheetDialog rounded, but I haven’t had any luck with anything online. This is what I would like for it to look like:

Rounded Modal Bottom Sheet

No matter what I’ve tried, I keep getting this:

Not rounded Modal Bottom Sheet

I’ve tried the method here and using shapeAppearanceLargeComponent (what I’m using now).

Here is my code:


 <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="shapeAppearanceLargeComponent">@style/CustomShapeAppearanceBottomSheetDialog</item>

<style name="CustomShapeAppearanceBottomSheetDialog" parent="">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSizeTopRight">16dp</item>
    <item name="cornerSizeTopLeft">16dp</item>


public class BottomNavMenuFragment extends BottomSheetDialogFragment {
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_bottom_nav_drawer, container, false);

And this is how I’m showing the fragment:

BottomNavMenuFragment navFragment = new BottomNavMenuFragment();, navFragment.getTag());

Nothing I seem to do works. Could someone point me in the right direction?


After messing around with the possible solutions people posted, I figured out that my code was working fine, but the corners of my NavigationView were obscuring the rounded corners of the drawer. After adding some padding, the rounded corners are displaying correctly.

Source: stackoverflow