我正在尝试更改打开对话框时显示的 scrimBackground。而且我知道在新的 MaterialComponents-Theme 中是这种情况的一个属性(scrimBackground)。但它目前不适合我。
在 material.io 网站上,背景也被描述为 scrimBackground,看起来它可以从主题中自定义。有谁知道我做错了什么?
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>