Created
November 15, 2017 07:52
-
-
Save konifar/df9285a7fa68ff2c9652ca234655fd1b to your computer and use it in GitHub Desktop.
Change menu item icon color
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void refreshMenuItem(@Nullable MenuItem menuItem) { | |
if (menuItem != null) { | |
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.vec_ic_refresh_22); | |
drawable = DrawableCompat.wrap(drawable); | |
DrawableCompat.setTintMode(drawable, PorterDuff.Mode.SRC_ATOP); | |
DrawableCompat.setTint(drawable, ResourcesCompat.getColor(getResources(), R.color.grey600, null)); | |
menuItem.setIcon(drawable); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment