getDrawableAttr

fun Context.getDrawableAttr(@AttrRes drawableAttr: Int): Drawable?

Creates a drawable from the given attribute resource which cannot be nullable type

Return

Drawable for the attribute, or null if not defined.

Parameters

drawableAttr

attribute resource for drawable

Throws

if the attribute is defined but is not a color or drawable resource.