getCompatDrawable

Avoids resource not found when using vector drawables in API levels < Lollipop

This method supports inflation of <vector>, <animated-vector> and <animated-selector> resources on devices where platform support is not available.

Return

Drawable object that can be used to draw this resource.

Parameters

resource

The resource id of the drawable or vector drawable

See also


fun Context.getCompatDrawable(@DrawableRes resource: Int, @ColorRes colorTint: Int): Drawable?

Avoids resource not found when using vector drawables in API levels < Lollipop Also images loaded from this method apply the Drawable.mutate to assure that the state of each drawable is not shared

Return

Drawable tinted with the tint color

Parameters

resource

The resource id of the drawable or vector drawable

colorTint

A specific color to tint the drawable

See also