getDrawableForDensity

@Nullable
open fun getDrawableForDensity(@NonNull res: @NonNull Resources, @DrawableRes id: Int, density: Int, @Nullable theme: @Nullable Resources.Theme): @Nullable Drawable

Return a drawable object associated with a particular resource ID for the given screen density in DPI and styled for the specified theme.

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.

density

The desired screen density indicated by the resource as found in DisplayMetrics.

theme

The theme used to style the drawable attributes, may be null.

Throws

Throws NotFoundException if the given ID does not exist.