AlertDialog.Builder项目背景颜色

Ros*_*one 6 android

我正在努力使这个AlertDialog的三个项目变绿.问题是目前警报后面出现绿色背景,其中两个项目不显示为绿色.我目前使用以下代码设置AlertDialog的样式:

final AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.ListRow));
Run Code Online (Sandbox Code Playgroud)

在我的styles.xml中,我有这样的风格:

<style name="ListRow">
    <item name="android:background">@color/forest_green</item>
    <item name="android:textSize">18sp</item>
    <item name="android:textColor">@color/dialog_text</item>
</style>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

小智 -1

像这样使用 styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AlertDialogCustom" parent="@android:style/AlertDialog">
    <item name="android:textColor">#00FF00</item>
    <item name="android:typeface">monospace</item>
    <item name="android:textSize">10sp</item>
</style>
Run Code Online (Sandbox Code Playgroud)