Skip to content

Commit a81dfb8

Browse files
committed
add icon color
1 parent 20c2f5d commit a81dfb8

5 files changed

Lines changed: 13 additions & 1 deletion

File tree

.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AndroidCore/src/main/java/cn/beingyi/androidcore/widget/RippleMenuView.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import android.content.Context;
44
import android.content.res.TypedArray;
5+
import android.graphics.Color;
6+
import android.graphics.PorterDuff;
57
import android.util.AttributeSet;
68
import android.util.TypedValue;
79
import android.view.LayoutInflater;
@@ -91,6 +93,7 @@ private void initAttr(AttributeSet attrs) {
9193
img_arrow.setVisibility(INVISIBLE);
9294
}
9395

96+
int iconColor = array.getColor(R.styleable.RippleMenuView_menuIconColor, Color.BLACK);
9497
float iconWidth = array.getLayoutDimension(R.styleable.RippleMenuView_menuIconWidth, 0);
9598
float iconHeight = array.getLayoutDimension(R.styleable.RippleMenuView_menuIconHeight, 0);
9699

@@ -99,6 +102,7 @@ private void initAttr(AttributeSet attrs) {
99102
lp.width = (int) iconWidth;
100103
lp.height = (int) iconHeight;
101104
img_icon.setLayoutParams(lp);
105+
img_icon.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
102106
}
103107
int labelTextColor = array.getColor(R.styleable.RippleMenuView_labelTextColor, 0);
104108
tv_label.setTextColor(labelTextColor);

AndroidCore/src/main/res/values/attr.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
<declare-styleable name="RippleMenuView">
2121
<attr name="menuIcon" format="reference|color" localization="suggested" />
22+
<attr name="menuIconColor" format="color|reference" localization="suggested" />
2223
<attr name="menuIconWidth" format="dimension" localization="suggested">
2324
<enum name="fill_parent" value="-1" />
2425
<enum name="match_parent" value="-1" />

0 commit comments

Comments
 (0)