2012-03-21 20 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); 
} 
相關問題