2012-03-21 21 views

回答

-2

我不确定您的活动窗口是什么意思,但您可以制作视图。

尝试这样的事:

myView.setAlpha(45); // 0-255 where 255 is non-transparent 
9

写在你的活动类

Window window = this.getWindow(); 
window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); 
+0

它是工作代码 – 2013-09-06 10:56:28

+0

它没有为我工作。但你可以使用半透明的主题android:Theme.Translucent – 2015-12-28 10:32:55

+0

它的工作原理,但只在基础(父视图)的布局,但它对我来说是好的,好工作 – koceeng 2017-01-05 03:20:41

0

有点晚了,但留给后人的缘故......您可以编程设置半透明的主题是这样的:

@Override 
public void onCreate(Bundle savedInstanceState) { 
    // Set a Translucent NoTitleBar theme before calling super.onCreate() 
    setTheme(android.R.style.Theme_Translucent_NoTitleBar); 

    super.onCreate(savedInstanceState); 
} 
相关问题