Question

I'm trying to make my Activity translucent, i.e. see-through, but it's not working. It's always opaque. That's my code so far:

public class SvetlinTranslucentActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window w = getWindow();
        w.setFormat(PixelFormat.RGBA_8888);
        w.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        w.setBackgroundDrawable(new ColorDrawable(0x00FF0000));
    }
}

I've been looking at the code from the official API demos but still no success.

Was it helpful?

Solution

I use android:background in my layout

<RelativeLayout android:id="@+id/RelativeLayout01" 
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android" 
android:background="#D0000000">

and its certainly see through, I can see the other activity below it.

OTHER TIPS

I would go for the AndroidManifest.xml, look for the target activity, and set: android:theme="@android:style/Theme.Translucent"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top