Skip to content

Commit

Permalink
增加了image属性,防止和src冲突
Browse files Browse the repository at this point in the history
  • Loading branch information
Kale committed May 28, 2018
1 parent d28dea8 commit 3996d67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/main/java/kale/injection/SelectorInjection.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public void loadFromAttributes(AttributeSet attrs, int defStyleAttr) {
showRipple = a.getBoolean(R.styleable.SelectorInjection_ripple, false);

Drawable src = a.getDrawable(R.styleable.SelectorInjection_src);
if (src == null) {
src = a.getDrawable(R.styleable.SelectorInjection_image);
}
if (src != null && view instanceof ImageView) {
((ImageView) view).setImageDrawable(src);
}
Expand Down
1 change: 1 addition & 0 deletions lib/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<attr name="android:drawableTop" />
<attr name="android:drawableBottom" />
<attr name="src" format="reference" />
<attr name="image" format="reference" />
<attr name="button" format="reference"/>
<attr name="background" format="reference" />

Expand Down

0 comments on commit 3996d67

Please sign in to comment.