Android Guides | Samples

Android.Content.Res.Resources.GetDrawableForDensity Method

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

Syntax

[Android.Runtime.Register("getDrawableForDensity", "(IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;", "GetGetDrawableForDensity_IILandroid_content_res_Resources_Theme_Handler")]
public virtual Drawable GetDrawableForDensity (Int32 id, Int32 density, Resources+Theme theme)

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 DisplayMetrics.
theme
The theme used to style the drawable attributes, may be null.

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 and styled for the specified 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 1