Can't make the Window of my Activity translucent
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. */
@Overri开发者_开发百科de
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.
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.
I would go for the AndroidManifest.xml, look for the target activity, and set: android:theme="@android:style/Theme.Translucent"
精彩评论