Int |
addLayer(dr: Drawable!)
Adds a new layer containing the specified drawable to the end of the layer list and returns its index.
|
Unit |
applyTheme(t: Resources.Theme)
Applies the specified theme to this Drawable and its children.
|
Boolean |
canApplyTheme()
|
Drawable! |
findDrawableByLayerId(id: Int)
Looks for a layer with the given ID and returns its Drawable.
If multiple layers are found for the given ID, returns the Drawable for the matching layer at the highest index.
|
Int |
findIndexByLayerId(id: Int)
Returns the layer with the specified id.
If multiple layers have the same ID, returns the layer with the lowest index.
|
Int |
getAlpha()
Gets the current alpha value for the drawable. 0 means fully transparent, 255 means fully opaque. This method is implemented by Drawable subclasses and the value returned is specific to how that class treats alpha. The default return value is 255 if the class does not override this method to return a value specific to its use of alpha.
|
Int |
getBottomPadding()
Returns the bottom padding in pixels.
A return value of -1 means there is no explicit padding set for this dimension. As a result, the value for this dimension returned by getPadding(android.graphics.Rect) will be computed from the child layers according to the padding mode (see getPaddingMode().
|
Int |
getChangingConfigurations()
Return a mask of the configuration parameters for which this drawable may change, requiring that it be re-created. The default implementation returns whatever was provided through setChangingConfigurations(int) or 0 by default. Subclasses may extend this to or in the changing configurations of any other drawables they hold.
|
Drawable.ConstantState? |
getConstantState()
Return a ConstantState instance that holds the shared state of this Drawable.
|
Drawable! |
getDrawable(index: Int)
Returns the drawable for the layer at the specified index.
|
Int |
getEndPadding()
Returns the end padding in pixels.
A return value of -1 means there is no explicit padding set for this dimension. As a result, the value for this dimension returned by getPadding(android.graphics.Rect) will be computed from the child layers according to the padding mode (see getPaddingMode().
|
Unit |
getHotspotBounds(outRect: Rect)
Populates outRect with the hotspot bounds.
|
Int |
getId(index: Int)
Returns the ID of the specified layer.
|
Int |
getIntrinsicHeight()
Returns the drawable's intrinsic height.
Intrinsic height is the height at which the drawable would like to be laid out, including any inherent padding. If the drawable has no intrinsic height, such as a solid color, this method returns -1.
|
Int |
getIntrinsicWidth()
Returns the drawable's intrinsic width.
Intrinsic width is the width at which the drawable would like to be laid out, including any inherent padding. If the drawable has no intrinsic width, such as a solid color, this method returns -1.
|
Int |
getLayerGravity(index: Int)
|
Int |
getLayerHeight(index: Int)
|
Int |
getLayerInsetBottom(index: Int)
|
Int |
getLayerInsetEnd(index: Int)
|
Int |
getLayerInsetLeft(index: Int)
|
Int |
getLayerInsetRight(index: Int)
|
Int |
getLayerInsetStart(index: Int)
|
Int |
getLayerInsetTop(index: Int)
|
Int |
getLayerWidth(index: Int)
|
Int |
getLeftPadding()
Returns the left padding in pixels.
A return value of -1 means there is no explicit padding set for this dimension. As a result, the value for this dimension returned by getPadding(android.graphics.Rect) will be computed from the child layers according to the padding mode (see getPaddingMode().
|
Int |
getNumberOfLayers()
Returns the number of layers contained within this layer drawable.
|
Int |
getOpacity()
Return the opacity/transparency of this Drawable. The returned value is one of the abstract format constants in android.graphics.PixelFormat: android.graphics.PixelFormat#UNKNOWN, android.graphics.PixelFormat#TRANSLUCENT, android.graphics.PixelFormat#TRANSPARENT, or android.graphics.PixelFormat#OPAQUE.
An OPAQUE drawable is one that draws all all content within its bounds, completely covering anything behind the drawable. A TRANSPARENT drawable is one that draws nothing within its bounds, allowing everything behind it to show through. A TRANSLUCENT drawable is a drawable in any other state, where the drawable will draw some, but not all, of the content within its bounds and at least some content behind the drawable will be visible. If the visibility of the drawable's contents cannot be determined, the safest/best return value is TRANSLUCENT.
Generally a Drawable should be as conservative as possible with the value it returns. For example, if it contains multiple child drawables and only shows one of them at a time, if only one of the children is TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be returned. You can use the method resolveOpacity to perform a standard reduction of two opacities to the appropriate single output.
Note that the returned value does not necessarily take into account a custom alpha or color filter that has been applied by the client through the setAlpha or #setColorFilter methods. Some subclasses, such as BitmapDrawable, ColorDrawable, and GradientDrawable, do account for the value of setAlpha, but the general behavior is dependent upon the implementation of the subclass.
|
Unit |
getOutline(outline: Outline)
Populates outline with the first available (non-empty) layer outline.
|
Boolean |
getPadding(padding: Rect)
Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds. Positive values move toward the center of the Drawable (set Rect.inset).
|
Int |
getPaddingMode()
|
Int |
getRightPadding()
Returns the right padding in pixels.
A return value of -1 means there is no explicit padding set for this dimension. As a result, the value for this dimension returned by getPadding(android.graphics.Rect) will be computed from the child layers according to the padding mode (see getPaddingMode().
|
Int |
getStartPadding()
Returns the start padding in pixels.
A return value of -1 means there is no explicit padding set for this dimension. As a result, the value for this dimension returned by getPadding(android.graphics.Rect) will be computed from the child layers according to the padding mode (see getPaddingMode().
|
Int |
getTopPadding()
Returns the top padding in pixels.
A return value of -1 means there is no explicit padding set for this dimension. As a result, the value for this dimension returned by getPadding(android.graphics.Rect) will be computed from the child layers according to the padding mode (see getPaddingMode().
|
Boolean |
hasFocusStateSpecified()
Indicates whether this drawable has at least one state spec explicitly specifying android.R.attr#state_focused.
Note: A View uses a Drawable instance as its background and it changes its appearance based on a state. On keyboard devices, it should specify its android.R.attr#state_focused to make sure the user knows which view is holding the focus.
|
Unit |
inflate(r: Resources, parser: XmlPullParser, attrs: AttributeSet, theme: Resources.Theme?)
Inflate this Drawable from an XML resource optionally styled by a theme. This can't be called more than once for each Drawable. Note that framework may have called this once to create the Drawable instance from XML resource.
|
Unit |
invalidateDrawable(who: Drawable)
Called when the drawable needs to be redrawn. A view at this point should invalidate itself (or at least the part of itself where the drawable appears).
|
Boolean |
isAutoMirrored()
Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left. See android.util.LayoutDirection.
|
Boolean |
isProjected()
|
Boolean |
isStateful()
Indicates whether this drawable will change its appearance based on state. Clients can use this to determine whether it is necessary to calculate their state and call setState.
|
Unit |
jumpToCurrentState()
If this Drawable does transition animations between states, ask that it immediately jump to the current state and skip any active animations.
|
Drawable |
mutate()
Make this drawable mutable. This operation cannot be reversed. A mutable drawable is guaranteed to not share its state with any other drawable. This is especially useful when you need to modify properties of drawables loaded from resources. By default, all drawables instances loaded from the same resource share a common state; if you modify the state of one instance, all the other instances will receive the same modification. Calling this method on a mutable Drawable will have no effect.
|
Unit |
onBoundsChange(bounds: Rect)
Override this in your subclass to change appearance if you vary based on the bounds.
|
Boolean |
onLayoutDirectionChanged(layoutDirection: Int)
Called when the drawable's resolved layout direction changes.
|
Boolean |
onLevelChange(level: Int)
Override this in your subclass to change appearance if you vary based on level.
|
Boolean |
onStateChange(state: IntArray)
Override this in your subclass to change appearance if you recognize the specified state.
|
Unit |
scheduleDrawable(who: Drawable, what: Runnable, when: Long)
A Drawable can call this to schedule the next frame of its animation. An implementation can generally simply call android.os.Handler#postAtTime(Runnable, Object, long) with the parameters (what, who, when) to perform the scheduling.
|
Unit |
setAlpha(alpha: Int)
Specify an alpha value for the drawable. 0 means fully transparent, and 255 means fully opaque.
|
Unit |
setAutoMirrored(mirrored: Boolean)
Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left). See android.util.LayoutDirection.
|
Unit |
setColorFilter(colorFilter: ColorFilter?)
Specify an optional color filter for the drawable.
If a Drawable has a ColorFilter, each output pixel of the Drawable's drawing contents will be modified by the color filter before it is blended onto the render target of a Canvas.
Pass null to remove any existing color filter.
Note: Setting a non-null color filter disables tint.
|
Unit |
setDither(dither: Boolean)
Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component.
|
Unit |
setDrawable(index: Int, drawable: Drawable!)
Sets the drawable for the layer at the specified index.
|
Boolean |
setDrawableByLayerId(id: Int, drawable: Drawable!)
Replaces the Drawable for the layer with the given id.
|
Unit |
setHotspot(x: Float, y: Float)
Specifies the hotspot's location within the drawable.
|
Unit |
setHotspotBounds(left: Int, top: Int, right: Int, bottom: Int)
Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.
|
Unit |
setId(index: Int, id: Int)
Sets the ID of a layer.
|
Unit |
setLayerGravity(index: Int, gravity: Int)
Sets the gravity used to position or stretch the specified layer within its container. Gravity is applied after any layer insets (see setLayerInset(int,int,int,int,int)) or padding (see setPaddingMode(int)).
If gravity is specified as Gravity.NO_GRAVITY, the default behavior depends on whether an explicit width or height has been set (see setLayerSize(int,int,int)), If a dimension is not set, gravity in that direction defaults to Gravity.FILL_HORIZONTAL or Gravity.FILL_VERTICAL; otherwise, gravity in that direction defaults to Gravity.LEFT or Gravity.TOP.
|
Unit |
setLayerHeight(index: Int, h: Int)
|
Unit |
setLayerInset(index: Int, l: Int, t: Int, r: Int, b: Int)
Specifies the insets in pixels for the drawable at the specified index.
|
Unit |
setLayerInsetBottom(index: Int, b: Int)
|
Unit |
setLayerInsetEnd(index: Int, e: Int)
|
Unit |
setLayerInsetLeft(index: Int, l: Int)
|
Unit |
setLayerInsetRelative(index: Int, s: Int, t: Int, e: Int, b: Int)
Specifies the relative insets in pixels for the drawable at the specified index.
|
Unit |
setLayerInsetRight(index: Int, r: Int)
|
Unit |
setLayerInsetStart(index: Int, s: Int)
|
Unit |
setLayerInsetTop(index: Int, t: Int)
|
Unit |
setLayerSize(index: Int, w: Int, h: Int)
Sets an explicit size for the specified layer.
Note: Setting an explicit layer size changes the default layer gravity behavior. See setLayerGravity(int,int) for more information.
|
Unit |
setLayerWidth(index: Int, w: Int)
|
Unit |
setOpacity(opacity: Int)
Sets the opacity of this drawable directly instead of collecting the states from the layers.
|
Unit |
setPadding(left: Int, top: Int, right: Int, bottom: Int)
Sets the absolute padding.
If padding in a dimension is specified as -1, the resolved padding will use the value computed according to the padding mode (see setPaddingMode(int)).
Calling this method clears any relative padding values previously set using setPaddingRelative(int,int,int,int).
|
Unit |
setPaddingMode(mode: Int)
Specifies how layer padding should affect the bounds of subsequent layers. The default value is PADDING_MODE_NEST.
|
Unit |
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)
Sets the relative padding.
If padding in a dimension is specified as -1, the resolved padding will use the value computed according to the padding mode (see setPaddingMode(int)).
Calling this method clears any absolute padding values previously set using setPadding(int,int,int,int).
|
Unit |
setTintBlendMode(blendMode: BlendMode!)
Specifies a tint blending mode for this drawable.
Defines how this drawable's tint color should be blended into the drawable before it is drawn to screen. Default tint mode is BlendMode.SRC_IN.
Note: Setting a color filter via setColorFilter(android.graphics.ColorFilter)
|
Unit |
setTintList(tint: ColorStateList?)
Specifies tint color for this drawable as a color state list.
A Drawable's drawing content will be blended together with its tint before it is drawn to the screen. This functions similarly to setColorFilter(int,android.graphics.PorterDuff.Mode).
Note: Setting a color filter via setColorFilter(android.graphics.ColorFilter) or setColorFilter(int,android.graphics.PorterDuff.Mode) overrides tint.
|
Boolean |
setVisible(visible: Boolean, restart: Boolean)
Set whether this Drawable is visible. This generally does not impact the Drawable's behavior, but is a hint that can be used by some Drawables, for example, to decide whether run animations.
|
Unit |
unscheduleDrawable(who: Drawable, what: Runnable)
A Drawable can call this to unschedule an action previously scheduled with scheduleDrawable. An implementation can generally simply call android.os.Handler#removeCallbacks(Runnable, Object) with the parameters (what, who) to unschedule the drawable.
|