Thwe
Thwe

Reputation: 103

android - Change Blur Background color behind AlertDialog

I want to change the black transparent background to white transparent, tried to change it in the AppTheme style but it didn't work.

https://i.sstatic.net/aYjBc.png

Also I want to change the black blur background to white blur, tried to change it in the AppTheme style.

I also tried renderscript, fastblur, xml mentioned in this, but it changed only the dialog white background

enter image description here

Any ideas how to change it? Thanks in advance!

Upvotes: 1

Views: 1757

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363687

Using the style you can change the dim not the blur.
You can use the android:backgroundDimAmount attribute (range: 1.0 - 0.0):

<style name="ThemeOverlay.App.MaterialAlertDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
    <item name="android:backgroundDimAmount">0.xx</item>
</style>

and

MaterialAlertDialogBuilder(context, R.style.ThemeOverlay_App_MaterialAlertDialog)
    .setTitle("Title")
    .show()

With 0.10 and 0.90

enter image description here enter image description here

Upvotes: 5

Related Questions