Android Guides | Samples

Android.Graphics.Drawables.LayerDrawable Class

A Drawable that manages an array of other Drawables.

See Also: LayerDrawable

Syntax

[Android.Runtime.Register("android/graphics/drawable/LayerDrawable", DoNotGenerateAcw=true)]
public class LayerDrawable : Drawable, Drawable+ICallback, IDisposable

Remarks

A Drawable that manages an array of other Drawables. These are drawn in array order, so the element with the largest index will be drawn on top.

It can be defined in an XML file with the <layer-list> element. Each Drawable in the layer is defined in a nested <item>.

For more information, see the guide to Drawable Resources.

[Android Documentation]

Requirements

Namespace: Android.Graphics.Drawables
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Graphics.Drawables.LayerDrawable are listed below.

See Also: Drawable

Public Constructors

Creates a new layer drawable with the list of specified layers.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Fields

const
PaddingModeNestLayerDrawablePaddingMode (0). Padding mode used to nest each layer inside the padding of the previous layer.
const
PaddingModeStackLayerDrawablePaddingMode (1). Padding mode used to stack each layer directly atop the previous layer.

Public Properties

[read-only]
NumberOfLayersInt32. Returns the number of layers contained within this layer drawable.
[read-only]
override
OpacityInt32. Return the opacity/transparency of this Drawable.
PaddingModeInt32.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

override
Draw(Canvas)
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).
FindDrawableByLayerId(Int32) : Drawable
Looks for a layer with the given ID and returns its Drawable.
GetDrawable(Int32) : Drawable
Returns the drawable for the layer at the specified index.
GetId(Int32) : Int32
Returns the ID of the specified layer.
InvalidateDrawable(Drawable)
Called when the drawable needs to be redrawn.
ScheduleDrawable(Drawable, IRunnable, Int64)
A Drawable can call this to schedule the next frame of its animation.
ScheduleDrawable(Drawable, Action, Int64)
override
SetAlpha(Int32)
Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.
override
SetColorFilter(ColorFilter)
Specify an optional color filter for the drawable.
SetDrawableByLayerId(Int32, Drawable) : Boolean
Replaces the Drawable for the layer with the given id.
SetId(Int32, Int32)
Sets the ID of a layer.
SetLayerInset(Int32, Int32, Int32, Int32, Int32)
Specifies the insets in pixels for the drawable at the specified index.
SetOpacity(Int32)
Sets the opacity of this drawable directly instead of collecting the states from the layers.
UnscheduleDrawable(Drawable, IRunnable)
A Drawable can call this to unschedule an action previously scheduled with ICallback.
UnscheduleDrawable(Drawable, Action)