Drawable Drawable Class

Definition

A Drawable is a general abstraction for "something that can be drawn.

[Android.Runtime.Register("android/graphics/drawable/Drawable", ApiSince=1, DoNotGenerateAcw=true)]
public abstract class Drawable : Java.Lang.Object
type Drawable = class
    inherit Object
Inheritance
DrawableDrawable
Derived
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Drawable() Drawable()
Drawable(IntPtr, JniHandleOwnership) Drawable(IntPtr, JniHandleOwnership)

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

Properties

Alpha Alpha

Gets the current alpha value for the drawable. 0 means fully transparent, 255 means fully opaque.

AutoMirrored AutoMirrored

Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left.

Bounds Bounds

Return the drawable's bounds Rect.

Callback Callback

Return the current Drawable.ICallback implementation attached to this Drawable.

ChangingConfigurations ChangingConfigurations

Return a mask of the configuration parameters for which this drawable may change, requiring that it be re-created.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
ColorFilter ColorFilter

Returns the current color filter, or null if none set.

Current Current
DirtyBounds DirtyBounds

Return the drawable's dirty bounds Rect.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
IntrinsicHeight IntrinsicHeight

Return the intrinsic height of the underlying drawable object.

IntrinsicWidth IntrinsicWidth

Return the intrinsic width of the underlying drawable object.

IsFilterBitmap IsFilterBitmap
IsStateful IsStateful

Indicates whether this drawable will change its appearance based on state.

IsVisible IsVisible
JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
LayoutDirection LayoutDirection
Level Level

Retrieve the current level.

MinimumHeight MinimumHeight

Returns the minimum height suggested by this Drawable.

MinimumWidth MinimumWidth

Returns the minimum width suggested by this Drawable.

Opacity Opacity

Return the opacity/transparency of this Drawable.

PeerReference PeerReference Inherited from Object
ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

TransparentRegion TransparentRegion

Returns a Region representing the part of the Drawable that is completely transparent.

Methods

ApplyTheme(Resources+Theme) ApplyTheme(Resources+Theme)

Applies the specified theme to this Drawable and its children.

CanApplyTheme() CanApplyTheme()
ClearColorFilter() ClearColorFilter()

Removes the color filter for this drawable.

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
CopyBounds() CopyBounds()

Return a copy of the drawable's bounds in a new Rect.

CopyBounds(Rect) CopyBounds(Rect)

Return a copy of the drawable's bounds in the specified Rect (allocated by the caller).

CreateFromPath(String) CreateFromPath(String)

Create a drawable from file path name.

CreateFromPathAsync(String) CreateFromPathAsync(String)
CreateFromResourceStream(Resources, TypedValue, Stream, String) CreateFromResourceStream(Resources, TypedValue, Stream, String)

Create a drawable from an inputstream, using the given resources and value to determine density information.

CreateFromResourceStream(Resources, TypedValue, Stream, String, BitmapFactory+Options) CreateFromResourceStream(Resources, TypedValue, Stream, String, BitmapFactory+Options)

Create a drawable from an inputstream, using the given resources and value to determine density information.

CreateFromResourceStreamAsync(Resources, TypedValue, Stream, String) CreateFromResourceStreamAsync(Resources, TypedValue, Stream, String)
CreateFromResourceStreamAsync(Resources, TypedValue, Stream, String, BitmapFactory+Options) CreateFromResourceStreamAsync(Resources, TypedValue, Stream, String, BitmapFactory+Options)
CreateFromStream(Stream, String) CreateFromStream(Stream, String)

Create a drawable from an inputstream

CreateFromStreamAsync(Stream, String) CreateFromStreamAsync(Stream, String)
CreateFromXml(Resources, XmlReader) CreateFromXml(Resources, XmlReader)

Create a drawable from an XML document.

CreateFromXml(Resources, XmlReader, Resources+Theme) CreateFromXml(Resources, XmlReader, Resources+Theme)

Create a drawable from an XML document using an optional Resources.Theme.

CreateFromXmlAsync(Resources, XmlReader) CreateFromXmlAsync(Resources, XmlReader)
CreateFromXmlAsync(Resources, XmlReader, Resources+Theme) CreateFromXmlAsync(Resources, XmlReader, Resources+Theme)
CreateFromXmlInner(Resources, XmlReader, IAttributeSet) CreateFromXmlInner(Resources, XmlReader, IAttributeSet)

Create from inside an XML document.

CreateFromXmlInner(Resources, XmlReader, IAttributeSet, Resources+Theme) CreateFromXmlInner(Resources, XmlReader, IAttributeSet, Resources+Theme)

Create a drawable from inside an XML document using an optional Resources.Theme.

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Draw(Canvas) Draw(Canvas)

Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).

Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
GetConstantState() GetConstantState()

Drawable ConstantState

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetHotspotBounds(Rect) GetHotspotBounds(Rect)
GetOutline(Outline) GetOutline(Outline)

Called to get the drawable to populate the Outline that defines its drawing area.

GetPadding(Rect) GetPadding(Rect)

Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds.

GetState() GetState()

Describes the current state, as a union of primitve states, such as R attr state_focused, R attr state_selected, etc.

Inflate(Resources, XmlReader, IAttributeSet) Inflate(Resources, XmlReader, IAttributeSet)

Inflate this Drawable from an XML resource.

Inflate(Resources, XmlReader, IAttributeSet, Resources+Theme) Inflate(Resources, XmlReader, IAttributeSet, Resources+Theme)

Inflate this Drawable from an XML resource optionally styled by a theme.

InflateAsync(Resources, XmlReader, IAttributeSet) InflateAsync(Resources, XmlReader, IAttributeSet)
InflateAsync(Resources, XmlReader, IAttributeSet, Resources+Theme) InflateAsync(Resources, XmlReader, IAttributeSet, Resources+Theme)
InvalidateSelf() InvalidateSelf()

Use the current Drawable.ICallback implementation to have this Drawable redrawn.

JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
JumpToCurrentState() JumpToCurrentState()

If this Drawable does transition animations between states, ask that it immediately jump to the current state and skip any active animations.

Mutate() Mutate()

Make this drawable mutable.

Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
OnBoundsChange(Rect) OnBoundsChange(Rect)

Override this in your subclass to change appearance if you vary based on the bounds.

OnLayoutDirectionChanged(Int32) OnLayoutDirectionChanged(Int32)
OnLevelChange(Int32) OnLevelChange(Int32)

Override this in your subclass to change appearance if you vary based on level.

OnStateChange(Int32[]) OnStateChange(Int32[])

Override this in your subclass to change appearance if you recognize the specified state.

ResolveOpacity(Int32, Int32) ResolveOpacity(Int32, Int32)

Return the appropriate opacity value for two source opacities.

ScheduleSelf(Action, Int64) ScheduleSelf(Action, Int64)
ScheduleSelf(IRunnable, Int64) ScheduleSelf(IRunnable, Int64)

Use the current Drawable.ICallback implementation to have this Drawable scheduled.

SetAlpha(Int32) SetAlpha(Int32)

Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.

SetBounds(Int32, Int32, Int32, Int32) SetBounds(Int32, Int32, Int32, Int32)

Specify a bounding rectangle for the Drawable.

SetCallback(Drawable+ICallback) SetCallback(Drawable+ICallback)

Bind a Drawable.ICallback object to this Drawable.

SetColorFilter(Color, PorterDuff+Mode) SetColorFilter(Color, PorterDuff+Mode)

Specify a color and Porter-Duff mode to be the color filter for this drawable.

SetColorFilter(ColorFilter) SetColorFilter(ColorFilter)

Specify an optional color filter for the drawable.

SetDither(Boolean) SetDither(Boolean)

Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component.

SetFilterBitmap(Boolean) SetFilterBitmap(Boolean)

Set to true to have the drawable filter its bitmaps with bilinear sampling when they are scaled or rotated.

SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetHotspot(Single, Single) SetHotspot(Single, Single)

Specifies the hotspot's location within the drawable.

SetHotspotBounds(Int32, Int32, Int32, Int32) SetHotspotBounds(Int32, Int32, Int32, Int32)

Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.

SetLayoutDirection(LayoutDirection) SetLayoutDirection(LayoutDirection)
SetLevel(Int32) SetLevel(Int32)

Specify the level for the drawable.

SetState(Int32[]) SetState(Int32[])

Specify a set of states for the drawable.

SetTint(Int32) SetTint(Int32)

Specifies tint color for this drawable.

SetTintList(ColorStateList) SetTintList(ColorStateList)

Specifies tint color for this drawable as a color state list.

SetTintMode(PorterDuff+Mode) SetTintMode(PorterDuff+Mode)

Specifies a tint blending mode for this drawable.

SetVisible(Boolean, Boolean) SetVisible(Boolean, Boolean)

Set whether this Drawable is visible.

ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
UnscheduleSelf(Action) UnscheduleSelf(Action)
UnscheduleSelf(IRunnable) UnscheduleSelf(IRunnable)

Use the current Drawable.ICallback implementation to have this Drawable unscheduled.

Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to