2

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.

Albus Dumbledore
  • 12,368
  • 23
  • 64
  • 105

2 Answers2

2

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.

daveD
  • 869
  • 1
  • 7
  • 24
0

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

nobalG
  • 4,544
  • 3
  • 34
  • 72
Abdellah Benhammou
  • 402
  • 1
  • 8
  • 22