Skip to content

Instantly share code, notes, and snippets.

@konifar
Created November 15, 2017 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konifar/df9285a7fa68ff2c9652ca234655fd1b to your computer and use it in GitHub Desktop.
Save konifar/df9285a7fa68ff2c9652ca234655fd1b to your computer and use it in GitHub Desktop.
Change menu item icon color
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