Created
April 1, 2016 09:46
-
-
Save messenger63/90afc7ccf68a4465ac1a1bc162070746 to your computer and use it in GitHub Desktop.
getColoredDrawable
This file contains 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
public static Drawable getColoredDrawable(@NonNull Context context, @DrawableRes int drawableRes, | |
@ColorRes int colorRes) { | |
Drawable drawable = ContextCompat.getDrawable(context, drawableRes); | |
int color = ContextCompat.getColor(context, colorRes); | |
Drawable wrappedDrawable = DrawableCompat.wrap(drawable); | |
DrawableCompat.setTint(wrappedDrawable, color); | |
return wrappedDrawable; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment