Modal bottom sheet - No dimming (scrim) of content underneath (Material Components Library)

239 Views Asked by At

Following the basic description on how to use the modal bottom sheet in the Android Material Components Library, there is no dimming of the content underneath the bottom sheet, even though the image in BottomSheet.md clearly shows dimming. This document also describes the dimming as a scrim, but there is no attribute exposed to set the scrim. I created a barebones app using the provided code in that doc, but there is no dimming.

Expected behavior: There should be dimming, or the ability to set the scrim of the content underneath the bottom sheet.

Source code:

class ModalBottomSheet : BottomSheetDialogFragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? = inflater.inflate(R.layout.modal_bottom_sheet_content, container, false)

    companion object {
        const val TAG = "ModalBottomSheet"
    }
}

 val modalBottomSheet = ModalBottomSheet()
 modalBottomSheet.show(supportFragmentManager, ModalBottomSheet.TAG)

Minimal sample app repro: See code snippet.

enter image description here

Android API version: 33

Material Library version: 1.9.0

Device: Pixel 6 emulator

0

There are 0 best solutions below