0

I'm trying to change the scrimBackground that show up when you opened a dialog. And I know that in the new MaterialComponents-Theme is an attribute for this case (scrimBackground). But it is currently not working for me.

On the material.io website that background is also descriped as the scrimBackground and it looks like that it is customizable from the Theme. Has anyone an idea what I'm doing wrong?

https://material.io/design/components/dialogs.html#theming

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="scrimBackground">@android:color/holo_blue_light</item>

    <item name="dialogTheme">@drawable/window_scrim</item>
    <item name="android:dialogTheme">@style/DialogTheme</item>
    <item name="alertDialogTheme">@style/AlertDialogTheme</item>
    <item name="android:alertDialogTheme">@style/AlertDialogTheme</item>
</style>

<style name="DialogTheme" parent="Theme.MaterialComponents.Dialog">
    <item name="scrimBackground">@drawable/window_scrim</item>
</style>

<style name="AlertDialogTheme" parent="Theme.MaterialComponents.Dialog.Alert">
    <item name="scrimBackground">@drawable/window_scrim</item>
</style>
Denis Schura
  • 761
  • 6
  • 10

1 Answers1

1

The Material code does not appear to use this attribute even though it is defined. This issue tracks this problem. In the meantime, you may be able to change this without a Material Theme using the advise in Changing default Android fade/scrim color when calling a Dialog.

user10740614
  • 106
  • 1