First, in your AndroidManifest.xml file, add:
- Code: Select all
android:theme="@android:style/Theme.Dialog"
Next, add these lines (or similar) to wherever you're displaying this:
Using java Syntax Highlighting
getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND,
WindowManager.LayoutParams.FLAG_DIM_BEHIND);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.alpha = 0.8f; // 80% alpha
lp.dimAmount = 0.5f; // Dim by 50%
getWindow().setAttributes(lp);
Parsed in 0.030 seconds, using
GeSHi 1.0.8.4
There is also "FLAG_BLUR_BEHIND", which blurs everything behind it, rather than dimming it.
EDIT: It's probably possible to do these things with a full screen application, like is shown there, but it's not done exactly like that, but hopefully this can point you in the right direction!
EDIT2: Just change "@android:style/Theme.Dialog" to "@android:style/Theme. Translucent" and it will work for full screen.
You might want to add a "requestWindowFeature(Window.FEATURE_NO_TITLE);" in there as well. (Just remember to do so
before setting it as the content view)