0

I am trying to make a bottom sheet with a rounded background but there is always a white background behind it

android v21


<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="create_notes.BottomSheet"
    android:clipToOutline="true"
    android:padding="@dimen/dp16"
    android:backgroundTint="@color/foreground"
    android:background="@drawable/bottom_sheet_layout">
 //....
</androidx.constraintlayout.widget.ConstraintLayout>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <solid android:color="@color/foreground"/>
    <corners android:topRightRadius="@dimen/dp24" android:topLeftRadius="@dimen/dp24"/>
</shape>

enter image description here

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
hab
  • 3
  • 2

1 Answers1

0

Add your style.xml

 <style name="AppBottomSheetDialogTheme"
        parent="Theme.Design.Light.BottomSheetDialog">
        <item name="bottomSheetStyle">@style/AppModalStyle</item>
    </style>

    <style name="AppModalStyle" parent="Widget.Design.BottomSheet.Modal">
        <item name="android:background">@drawable/rounded_dialog_bg</item>
    </style>

java class add style

BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(InstaActivity.this, R.style.AppBottomSheetDialogTheme);
Harshil
  • 162
  • 11