0

When I use

getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
                WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

in my Activity I don't get slightly blurred screen under current Activity but completely black one (top Activity is fine). Need to say it is also black in sample which came with SDK. Can somebody suggest how to make it blurry?

Eugene
  • 59,186
  • 91
  • 226
  • 333

2 Answers2

2

In your AndroidManifest.xml add this line to your Activity declaration: android:theme="@android:style/Theme.Translucent.NoTitleBar" otherwise the activity will have a solid background (and thus blur has no effect).

Also, this post on StackOverflow is helpful, in particular the cautionary notes. On older devices this causes your application to become unresponsive (it is a CPU-intense software rendering), and on newer devices this constant is deprecated and no longer has any effect (see Android Documentation for WindowManager.LayoutParams).

Deprecated on latest versions of OS (check documentation).

Community
  • 1
  • 1
Tom
  • 6,947
  • 7
  • 46
  • 76
  • I have this theme specified in AndroidManifest.xml, sorry not mentioned that. – Eugene Jul 06 '12 at 14:16
  • 1
    What version of Android are you running? I'm not positive, but I believe that constant was deprecated in Honeycomb API 11. I can confirm on 4.0 ICS or 4.1 Jelly Bean this constant doesn't do anything. – Tom Jul 06 '12 at 14:50
0

Note: the flag FLAG_BLUR_BEHIND is depreciated.

You can use FLAG_DIM_BEHIND Instead.