As you can see the part on top of the dialog is entirely white and not dimmed as it should be by default
I tried messing with styles, making windowBackground and Background transparent also doing it programatically. I tried making it in a new clean project and it worked correctly without any modifications whatsoever, as far as i can tell it should be default behavior and it's not the emulator/device problem as it worked with the new project. Here's the code
itemNotification.setOnClickListener {
notificationsBottomSheetDialog.show()
}
notificationsBottomSheetBinding = FragmentNotificationsBottomSheetBinding.inflate(layoutInflater)
notificationsBottomSheetDialog = BottomSheetDialog(requireContext(), style.CustomBottomSheetDialog)
notificationsBottomSheetDialog.setCanceledOnTouchOutside(false)
notificationsBottomSheetDialog.setContentView(notificationsBottomSheetBinding.root)
Bottom sheet layout.xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/core_padding_16"
android:paddingTop="@dimen/core_vertical_margin_16"
android:paddingBottom="@dimen/core_vertical_margin">
<other stuff but not empty>
All the styles
CustomBottomSheetDialog:
parent = ThemeOverlay.MaterialComponents.BottomSheetDialog
bottomSheetStyle = @style/CustomBottomSheet => @style/CustomBottomSheet
CustomBottomSheet:
parent = Widget.MaterialComponents.BottomSheet
shapeAppearanceOverlay = @style/CustomShapeAppearanceBottomSheetDialog
CustomShapeAppearanceBottomSheetDialog:
cornerFamily = rounded
cornerSizeTopRight = 16dp
cornerSizeTopLeft = 16dp
cornerSizeBottomRight = 0dp
cornerSizeBottomLeft = 0dp
android:windowSoftInputMode = adjustResize
It also doesn't have rounded corners on top without the style even though in the new app it did, initializing it without the style still does the same white background
The dialog is called from a fragment if that makes a difference
You could try by setting within onCreate a style this way
Then provide a style in
styles.xml
The XML can be as you desire with a background.xml file added to you view