1

When AlertDialog is being shown, the whole screen hue/color changes. Is it somehow possible to define to which color should it be changed? Below are screens - before and after AlertDialog appears.

Before:

sreen before AlertDialog appears

After:

screen after AlertDialog appears

You can see that the screen color changed.

What I noticed it looks like it is not the color change, but just all colors are becoming darker. Can I somehow define how this change should work like?

Sebeg13
  • 281
  • 3
  • 6

1 Answers1

1

It could be because FLAG_DIM_BEHIND is set on your dialog window.

In that case you can remove it with the clear flags method: dialogWindow.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)

One quick way to check which flags are set on your window is to check the mAttrs-field on your window in adb shell dumpsys window windows.

gluckspatz
  • 11
  • 2
  • It helps in a way that after this command the color of background does not change in any way - colors are not becoming darker. I wonder if it is somehow possible to define how this color should be changing. For those who can't acces dialogWindow - you can get this by **alertDialog.getWindow()** – Sebeg13 Mar 22 '21 at 08:09
  • Yes it is possible to set the android:windowBackground on the dialog via the dialogs style. – gluckspatz Mar 22 '21 at 13:54