[英]Changing textcolor to black made dialog title disappear
我在整個應用程序中使用以下主題
<style name="AppTheme" parent="android:Theme.WithActionBar" >
<item name="android:textColor">#000000</item>
</style>
問題:當我顯示對話框時,標題欄對話框為黑色,並且由於我將文本設置為黑色,因此文本不會出現。 我該如何解決對話框問題? 或至少是針對特定對話框?
謝謝
在資源中,包括以下內容:
<?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>
要構造對話框,請使用以下命令:
new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.AboutDialog))
如果您使用的是自定義布局,則執行以下操作:
View view = View.inflate(new ContextThemeWrapper(context, R.style.AboutDialog), R.layout.about_dialog, null);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.