1

I'm trying to dim/blur the backgruond BEHIND a Dialog box. In the past, I've used this code:

dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

But as this question states, the WindowManager.LayoutParams.FLAG_BLUR_BEHIND flag is now deprecated as of API 14. Is there a way I can dim the background of a Dialog box NOT using this flag? Thanks

Community
  • 1
  • 1
Harry
  • 772
  • 10
  • 32

2 Answers2

7

Try

getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) 

Another alternative:

getWindow().setBackground(new ColorDrawable(0x7000000))
0

Kotlin Code , put it before setContentView :

 window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
Hamed Jaliliani
  • 2,789
  • 24
  • 31