2013-07-08 119 views
0

我使用下面的主題爲整個應用程序更改文本顏色爲黑色發對話框的標題消失

<style name="AppTheme" parent="android:Theme.WithActionBar" > 
    <item name="android:textColor">#000000</item>   
</style> 

的問題,當我顯示對話框,標題欄對話框是黑色的,因爲我設置文本爲黑色則文字不會出現。我怎樣才能解決這個對話框?或者至少對於特定的對話?

謝謝

+1

你試過嗎? http://blog.andromo.com/2011/fixing-text-colours-on-an-alertdialog-when-using-theme-light/不幸的是,它僅在Honeycomb後才起作用。 – Codeman

+0

哦,它太棒了!無論如何,我希望它可以用於發佈蜂窩,因爲我擁有以前的輕量級主題。發佈它作爲答案我會接受它。謝謝 – Snake

+0

完成,它張貼:) – Codeman

回答

0

There is a walkthrough on how to do this here

在資源,包括:如果你使用的是

new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.AboutDialog)) 

或者這樣:

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
<!-- AlertDialog text color fix thanks to Shawn Castrianni, see: http://groups.google.com/group/android-developers/browse_thread/thread/f0b34621d3a70c4b --> 
<style name="AboutDialog" parent="@android:style/Theme.Dialog"> 
<item name="android:textColor">?android:attr/textColorPrimaryInverseDisableOnly</item> 
</style> 
</resources> 

構建你的對話框,使用此自定義佈局:

View view = View.inflate(new ContextThemeWrapper(context, R.style.AboutDialog), R.layout.about_dialog, null); 
相關問題