Home » Android » How to Change the Color Behind Android Dialog

How to Change the Color Behind Android Dialog

Posted by: admin May 14, 2020 Leave a comment


I would like to change the color of the dimmed background that surrounds an Android dialog (not the Window background drawable) programmatically. I am using a dialog themed activity. I do not want to dim it, nor blur it.

If you imagine a dialog with three buttons, I would like to have it do something like this:

  • Click A: background to translucent red
  • Click B: background to translucent yellow
  • Click C: background to translucent green
How to&Answers:

I’m not sure you can change the color of the background. The dimming is controlled by the dimAmount field of the layout for the dialog window (as well as the FLAG_DIM_BEHIND flag). dimAmount is just a float between 0.0 and 1.0 that controls the amount of dimming (transparent to totally opaque). I think it’s just an alpha blend of the existing background; there’s no control of coloring as far as I’ve been able to find.


If you’re using Activity with Theme.Dialog then you should look into your xml file for layout and then change background color of outermost container.