瀏覽代碼

MDTintHelper uses setBackground() instead of setBackgroundDrawable() >= API 16

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

+ 6 - 1
library/src/main/java/com/afollestad/materialdialogs/internal/MDTintHelper.java

@@ -62,7 +62,12 @@ public class MDTintHelper {
             Drawable drawable = ContextCompat.getDrawable(editText.getContext(), R.drawable.abc_edit_text_material);
             DrawableWrapper d = new DrawableWrapper(drawable);
             d.setTintList(s1);
-            editText.setBackgroundDrawable(d);
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+                editText.setBackground(d);
+            } else {
+                //noinspection deprecation
+                editText.setBackgroundDrawable(d);
+            }
         }
     }