2016-09-22 82 views
0

我想更改對話框的覆蓋顏色。第一個是透明的灰色。如何更改對話框的背景覆蓋顏色

我想:

<item name="android:windowContentOverlay">@color/customColor</item> 
<item name="android:colorBackgroundCacheHint">@color/customColor</item> 

他們沒有工作。當我嘗試時:

<item name="android:windowBackground">@color/customColor</item> 

內容背景正在改變。

回答

0

我發現了一個規則解決方案!

d.getWindow().setBackgroundDrawableResource(R.drawable.menubackground); 

它適用於我的正常對話框。 但我不知道它是否適用於AlertDialog

+0

'R.color.menubackground'工作嗎? – Housefly

+0

不,你必須提供它作爲drawable –