Android.Content.Res.Resources.GetDrawableForDensity Method
Return a drawable object associated with a particular resource ID for the given screen density in DPI.

Syntax

[Android.Runtime.Register("getDrawableForDensity", "(II)Landroid/graphics/drawable/Drawable;", "GetGetDrawableForDensity_IIHandler")]
public virtual Android.Graphics.Drawables.Drawable GetDrawableForDensity (int id, int density)

See Also

Resources.GetDrawableForDensity(int, System.Int32, System.Int32)

Parameters

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 Android.Util.DisplayMetrics.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
!:NoType:android/content/res/Resources$NotFoundException;Href=../../../../reference/android/content/res/Resources.NotFoundException.htmlThrows NotFoundException if the given ID does not exist.

Remarks

Return a drawable object associated with a particular resource ID for the given screen density in DPI. This will set the drawable's density to be the device's density multiplied by the ratio of actual drawable density to requested density. This allows the drawable to be scaled up to the correct size if needed. Various types of objects will be returned depending on the underlying resource -- for example, a solid color, PNG image, scalable image, etc. The Drawable API hides these implementation details.

Note: To obtain a themed drawable, use Android.Content.Context.GetDrawable(int) or Resources.GetDrawableForDensity(int, System.Int32, System.Int32) passing the desired theme.

[Android Documentation]

Requirements

Namespace: Android.Content.Res
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 15