我使用此命令更改了AlertDialog标题的颜色
alert.setTitle( Html.fromHtml("<font color='#FF7F27'>Set IP Address</font>"));
Run Code Online (Sandbox Code Playgroud)
但我想改变标题下出现的线条的颜色; 我怎样才能做到这一点 ?
注意:我不想使用自定义布局

我已经突破了这个问题.我需要做的是,AlertDialog在我的Android应用程序中更改所有s 的样式- 对话框背景需要是white-ish,文本需要是black-ish.我尝试创建了很多样式,主题,并从代码,清单等应用,但没有成功,关于内部的文本颜色AlertDialog.现在,我有最简单的代码,设置如下:
表现:
Run Code Online (Sandbox Code Playgroud)<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >
styles.xml:
Run Code Online (Sandbox Code Playgroud)<style name="AppTheme" parent="AppBaseTheme"> <item name="android:alertDialogStyle">@style/DialogStyle</item> </style> <style name="DialogStyle" parent="@android:style/Theme.Dialog"> <!-- changing these background stuff works fine --> <item name="android:bottomBright">@android:color/white</item> <item name="android:bottomDark">@android:color/white</item> <item name="android:bottomMedium">@drawable/dialog_footer_bg</item> <item name="android:centerBright">@android:color/white</item> <item name="android:centerDark">@drawable/dialog_body_bg</item> <item name="android:centerMedium">@android:color/white</item> <item name="android:fullBright">@color/orange</item> <item name="android:fullDark">@color/orange</item> <item name="android:topBright">@color/green</item> <item name="android:topDark">@drawable/dialog_header_bg</item>
下面列出的项目不起作用(请阅读我在每个元素上面的评论):
Run Code Online (Sandbox Code Playgroud)<!-- panelBackground is not getting set to null, there is something squarish around it --> <item name="android:panelBackground">@null</item> <!-- Setting this textColor doesn't seem to have any effect at …
我有一个对话框,对我来说效果很好,但我想在此对话框中为两个按钮设置背景.它的结构非常复杂,所以我不想将它重写为自定义对话框.但在这种情况下,是否有可能设置背景(更具体地说,有没有办法将样式设置为正/负/中性按钮)?