Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Theme.Translucent fails on ICS

I'm using: android:theme="@android:style/Theme.Translucent.NoTitleBar"

in combination with: getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);

to get a nice transparent background blur effect, emulates a dialog style.

This works great on 2.3 and down, but it is a solid color(read not transparent) on devices running ICS / 3.0 and up. I know they introduced a holo theme and there does not seem to be a specific Theme.Holo.Translucent theme. Any ideas on how to get a translucent background on both ICS and older, I'm not opposed to using separate themes defined in values-v11.

like image 391
sgarman Avatar asked Jan 06 '12 23:01

sgarman


2 Answers

Use

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

or extend Theme.Translucent.NoTitleBar and add

<item name="android:windowBackground">@android:color/transparent</item>
like image 170
Zsolt Safrany Avatar answered Oct 10 '22 14:10

Zsolt Safrany


It seems they deprecated blurring, at least with FLAG_BLUR_BEHIND:

public static final int FLAG_BLUR_BEHIND

This constant is deprecated. Blurring is no longer supported.

like image 40
aromero Avatar answered Oct 10 '22 13:10

aromero