I have designed a bottom sheet dialog which is using the entire screen width. This dialog is aligned bottom and have rounded corner on the top left/right part.
the layout is as below:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bottom_sheet_rounded_corner">
<TextView..
...
</androidx.constraintlayout.widget.ConstraintLayout>
The drawable is as below:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/solidnight" />
<corners
android:topLeftRadius="8dp"
android:topRightRadius="8dp" />
<padding
android:bottom="0dp"
android:left="0dp"
android:right="0dp"
android:top="0dp" />
</shape>
it's look like this :
It's working but I need to add a shadow around now as shown in the image below:
I know the shadow could be tricky to see
Any idea how ? thanks




Try this once
1.Define a custom style in your styles.xml file with the desired elevation:
2.When creating your BottomSheetDialog, pass in the custom style:
This will apply a shadow with an elevation of 8dp around the BottomSheetDialog. You can adjust the elevation to your liking.
Note that this approach only works for API level 21 and above. For API levels below 21, you can use the elevation attribute on a custom background drawable for the BottomSheetDialog.
You can refer to the following Stack Overflow post for more information on how to do this.