createTintedDrawable

fun createTintedDrawable(drawable: Drawable?, @ColorInt color: Int, mode: PorterDuff.Mode = PorterDuff.Mode.SRC_IN): Drawable?

Uses compatibility library to create a tinted a drawable. Supports all important versions of Android.

Return

A tinted Drawable. Wraps the Drawable in a new class - instanceof will NOT match the old type

Parameters

drawable

Drawable to tint

color

Color to tint to, not R.color.whatever, must be resolved

mode

Mode of tinting to use


Uses compatibility library to create a tinted a drawable. Supports all important versions of Android.

Return

A tinted Drawable. Wraps the Drawable in a new class - instanceof will NOT match the old type

Parameters

drawable

Drawable to tint

color

Color to tint to

mode

Mode of tinting to use