0

I would like to solve the problem I've got. I made a dialog above a activity of android, but I would like to make the background black(opaque). All the guide shows only how to make it transparent. How can I make it opaque?

  • This Link May help you Pleas check it once http://stackoverflow.com/questions/18461990/pop-up-window-to-display-some-stuff-in-a-fragment – Nagaraja Dec 05 '13 at 14:02

3 Answers3

0

Yes, it is. You can control it.

After creating dialog:

WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();  
lp.dimAmount=0.0f; // Dim level. 0.0 - no dim, 1.0 - completely opaque
dialog.getWindow().setAttributes(lp);

Upd: you can even add blur behind the dialog:

dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
Virag Brahme
  • 2,062
  • 1
  • 20
  • 32
0

Hello If i understand your question correctly then you can do it by below code :

Drawable d = new ColorDrawable(Color.BLACK);
        d.setAlpha(130);
        mDialog.getWindow().setBackgroundDrawable(d);
Herry
  • 7,037
  • 7
  • 50
  • 80
0

Use this line :

dialog.getWindow().setBackgroundDrawable(
                new ColorDrawable(0xff000000));

hope it helps :)

Rudi
  • 4,304
  • 4
  • 34
  • 44