2013-01-15 20 views
0
是位於價值/風格

我已經創建自定義對話框:對話主題不使用

<style name="AppTheme" parent="android:Theme.Light" /> 

<style name="MyDialogTheme" parent="android:Theme.Dialog"> 

    <item name="android:windowBackground">@null</item> 
    <item name="android:windowNoTitle">true</item> 
</style> 

然後我想使用它:

final Dialog dialogC = new Dialog(context,R.style.MyDialogTheme); 
dialogC.setContentView(R.layout.confirm); 

我沒有錯誤,但仍然使用默認主題。當我將它用於我希望作爲對話出現的活動時,此主題非常完美。

回答

1

使用這一塊,這對我來說

dialog3=new Dialog(MainActivity.this); 
     dialog3.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     dialog3.setContentView(R.layout.one_button_dialog4); 
+0

工作,但我想去除背景也 – Dim