getDrawable
open fun getDrawable(@NonNull res: Resources, @DrawableRes id: Int, @Nullable theme: Resources.Theme): Drawable(source)
Return a drawable object associated with a particular resource ID and styled for the specified theme. Various types of objects will be returned depending on the underlying resource -- for example, a solid color, PNG image, scalable image, etc.
Prior to API level 21, the theme will not be applied and this method simply calls through to getDrawable.
Return
Drawable An object that can be used to draw this resource.
Parameters
res
resources to use for getting the drawable.
id
The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.
theme
The theme used to style the drawable attributes, may be null
.
Throws
Throws NotFoundException if the given ID does not exist.