skip to Main Content

I have the following attributes for bottom sheet dialog:

<style name="DialogStyle" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="android:windowIsFloating">false</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowSoftInputMode">adjustResize</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="bottomSheetStyle">@style/RoundedBottomSheet</item>
    <style name="RoundedBottomSheet" parent="Widget.Design.BottomSheet.Modal">
        <item name="android:background">@android:color/transparent</item>
        <item name="android:windowEnterAnimation">@anim/popup_window_enter_animation</item>
        <item name="android:windowExitAnimation">@anim/popup_window_exit_animation</item>
    </style>

In Versions under android 14 I see the dim background by default, but on android 14 I don’t see any dim, the background is transparent.
How to add the dim?

I tried to add this but it doesn’t work

<item name="android:backgroundDimEnabled">true</item>

2

Answers


  1. Apart from adding:

    <item name="android:backgroundDimEnabled">true</item>
    

    Could you also add the following line after it, in order to define the Dim Amount:

    <item name="android:backgroundDimAmount">0.5</item>
    

    It’s an adjustable floating value ranging from 0.0 (no dim) to 1.0 (completely opaque).

    Login or Signup to reply.
  2. I have the same problem on the emulator. But the dim shows again when I "Disable HW overlays" in the Developer options.

    enter image description here

    I have tested on the real device with Android 14 and only the emulator does not show dim.

    Issue tracker – https://issuetracker.google.com/issues/289117017

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search