瀏覽代碼

Default list item color is black or white depending on the theme.

Aidan Follestad 10 年之前
父節點
當前提交
db3b96ef56
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

+ 8 - 1
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -54,6 +54,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener,
     private TextView title;
     private View titleFrame;
 
+    private final int defaultItemColor;
     private int contentColor;
     private Context mContext;
     private CharSequence positiveText;
@@ -166,6 +167,12 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener,
             content.setTextColor(contentColor);
         }
 
+        if(builder.theme == Theme.LIGHT) {
+            defaultItemColor = Color.BLACK;
+        } else {
+            defaultItemColor = Color.WHITE;
+        }
+
         if (customView != null) {
             title = (TextView) view.findViewById(R.id.titleCustomView);
             icon = (ImageView) view.findViewById(R.id.iconCustomView);
@@ -1201,7 +1208,7 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener,
 
         public MaterialDialogAdapter(Context context, int resource, int textViewResourceId, CharSequence[] objects) {
             super(context, resource, textViewResourceId, objects);
-            itemColor = DialogUtils.resolveColor(getContext(), R.attr.md_item_color, contentColor);
+            itemColor = DialogUtils.resolveColor(getContext(), R.attr.md_item_color, defaultItemColor);
         }
 
         @Override