# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: XML Attrs | Inherited XML Attrs | Constants | Inherited Constants | Ctors | Methods | Protected Methods | Inherited Methods

# RippleDrawable

`public class RippleDrawable`
`` `` `extends LayerDrawable` ``

java.lang.Object
↳ | android.graphics.drawable.Drawable
| ↳ | android.graphics.drawable.LayerDrawable
|  | ↳ | android.graphics.drawable.RippleDrawable

Drawable that shows a ripple effect in response to state changes. The anchoring position of the ripple for a given state may be specified by calling `setHotspot(float, float)` with the corresponding state attribute identifier.

A touch feedback drawable may contain multiple child layers, including a special mask layer that is not drawn to the screen. A single layer may be set as the mask from XML by specifying its `android:id` value as `R.id.mask`. At run time, a single layer may be set as the mask using `setId(..., android.R.id.mask)` or an existing mask layer may be replaced using `setDrawableByLayerId(android.R.id.mask, ...)`.

     <!-- A red ripple masked against an opaque rectangle. --/>
     <ripple android:color="#ffff0000">
       <item android:id="@android:id/mask"
             android:drawable="@android:color/white" />
     </ripple>

If a mask layer is set, the ripple effect will be masked against that layer before it is drawn over the composite of the remaining child layers.

If no mask layer is set, the ripple effect is masked against the composite of the child layers.

     <!-- A green ripple drawn atop a black rectangle. --/>
     <ripple android:color="#ff00ff00">
       <item android:drawable="@android:color/black" />
     </ripple>

     <!-- A blue ripple drawn atop a drawable resource. --/>
     <ripple android:color="#ff0000ff">
       <item android:drawable="@drawable/my_drawable" />
     </ripple>

If no child layers or mask is specified and the ripple is set as a View background, the ripple will be drawn atop the first available parent background within the View's hierarchy. In this case, the drawing region may extend outside of the Drawable bounds.

     <!-- An unbounded red ripple. --/>
     <ripple android:color="#ffff0000" />

## Summary

### XML attributes
`android:color` | The color to use for ripple effects.
`android:radius` | The radius of the ripple when fully expanded.

### Inherited XML attributes
From class `android.graphics.drawable.LayerDrawable`
`android:bottom` | Bottom inset to apply to the layer.
`android:drawable` | Drawable used to render the layer.
`android:end` | End inset to apply to the layer.
`android:gravity` | Gravity used to align the layer within its container.
`android:height` | Height of the layer.
`android:id` | Identifier of the layer.
`android:left` | Left inset to apply to the layer.
`android:paddingBottom` | Explicit bottom padding.
`android:paddingEnd` | Explicit end padding.
`android:paddingLeft` | Explicit left padding.
`android:paddingMode` | Indicates how layer padding should affect the bounds of subsequent layers.
`android:paddingRight` | Explicit right padding.
`android:paddingStart` | Explicit start padding.
`android:paddingTop` | Explicit top padding.
`android:right` | Right inset to apply to the layer.
`android:start` | Start inset to apply to the layer.
`android:top` | Top inset to apply to the layer.
`android:width` | Width of the layer.

### Constants
`int` | `RADIUS_AUTO` Radius value that specifies the ripple radius should be computed based on the size of the ripple's container.

### Inherited constants
From class `android.graphics.drawable.LayerDrawable`
`int` | `INSET_UNDEFINED` Value used for undefined start and end insets.
`int` | `PADDING_MODE_NEST` Padding mode used to nest each layer inside the padding of the previous layer.
`int` | `PADDING_MODE_STACK` Padding mode used to stack each layer directly atop the previous layer.

### Public constructors
`RippleDrawable(ColorStateList color, Drawable content, Drawable mask)` Creates a new ripple drawable with the specified ripple color and optional content and mask drawables.

### Public methods
`void` | `applyTheme(Resources.Theme t)` Applies the specified theme to this Drawable and its children.
`boolean` | `canApplyTheme()`
`void` | `draw(Canvas canvas)` Optimized for drawing ripples with a mask layer and optional content.
`Drawable.ConstantState` | `getConstantState()` Return a `ConstantState` instance that holds the shared state of this Drawable.
`Rect` | `getDirtyBounds()` Return the drawable's dirty bounds Rect.
`void` | `getHotspotBounds(Rect outRect)` Populates `outRect` with the hotspot bounds.
`int` | `getOpacity()` This method is deprecated. This method is no longer used in graphics optimizations
`void` | `getOutline(Outline outline)` Populates `outline` with the first available layer outline, excluding the mask layer.
`int` | `getRadius()`
`void` | `inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)` Inflate this Drawable from an XML resource optionally styled by a theme.
`void` | `invalidateSelf()` Use the current `Callback` implementation to have this Drawable redrawn.
`boolean` | `isStateful()` Indicates whether this drawable will change its appearance based on state.
`void` | `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.
`void` | `setColor(ColorStateList color)` Sets the ripple color.
`boolean` | `setDrawableByLayerId(int id, Drawable drawable)` Replaces the `Drawable` for the layer with the given id.
`void` | `setHotspot(float x, float y)` Specifies the hotspot's location within the drawable.
`void` | `setHotspotBounds(int left, int top, int right, int bottom)` Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.
`void` | `setPaddingMode(int mode)` Specifies how layer padding should affect the bounds of subsequent layers.
`void` | `setRadius(int radius)` Sets the radius in pixels of the fully expanded ripple.
`boolean` | `setVisible(boolean visible, boolean restart)` Set whether this Drawable is visible.

### Protected methods
`void` | `onBoundsChange(Rect bounds)` Override this in your subclass to change appearance if you vary based on the bounds.
`boolean` | `onStateChange(int[] stateSet)` Override this in your subclass to change appearance if you recognize the specified state.

### Inherited methods
From class `android.graphics.drawable.LayerDrawable`
`int` | `addLayer(Drawable dr)` Adds a new layer containing the specified `drawable` to the end of the layer list and returns its index.
`void` | `applyTheme(Resources.Theme t)` Applies the specified theme to this Drawable and its children.
`boolean` | `canApplyTheme()`
`void` | `draw(Canvas canvas)` Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).
`Drawable` | `findDrawableByLayerId(int id)` Looks for a layer with the given ID and returns its `Drawable`.
`int` | `findIndexByLayerId(int id)` Returns the layer with the specified `id`.
`int` | `getAlpha()` Gets the current alpha value for the drawable.
`int` | `getBottomPadding()` Returns the bottom padding in pixels.
`int` | `getChangingConfigurations()` Return a mask of the configuration parameters for which this drawable may change, requiring that it be re-created.
`Drawable.ConstantState` | `getConstantState()` Return a `ConstantState` instance that holds the shared state of this Drawable.
`Drawable` | `getDrawable(int index)` Returns the drawable for the layer at the specified index.
`int` | `getEndPadding()` Returns the end padding in pixels.
`void` | `getHotspotBounds(Rect outRect)` Populates `outRect` with the hotspot bounds.
`int` | `getId(int index)` Returns the ID of the specified layer.
`int` | `getIntrinsicHeight()` Returns the drawable's intrinsic height.
`int` | `getIntrinsicWidth()` Returns the drawable's intrinsic width.
`int` | `getLayerGravity(int index)`
`int` | `getLayerHeight(int index)`
`int` | `getLayerInsetBottom(int index)`
`int` | `getLayerInsetEnd(int index)`
`int` | `getLayerInsetLeft(int index)`
`int` | `getLayerInsetRight(int index)`
`int` | `getLayerInsetStart(int index)`
`int` | `getLayerInsetTop(int index)`
`int` | `getLayerWidth(int index)`
`int` | `getLeftPadding()` Returns the left padding in pixels.
`int` | `getNumberOfLayers()` Returns the number of layers contained within this layer drawable.
`int` | `getOpacity()` This method is deprecated. This method is no longer used in graphics optimizations
`void` | `getOutline(Outline outline)` Populates `outline` with the first available (non-empty) layer outline.
`boolean` | `getPadding(Rect padding)` Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds.
`int` | `getPaddingMode()`
`int` | `getRightPadding()` Returns the right padding in pixels.
`int` | `getStartPadding()` Returns the start padding in pixels.
`int` | `getTopPadding()` Returns the top padding in pixels.
`void` | `inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)` Inflate this Drawable from an XML resource optionally styled by a theme.
`void` | `invalidateDrawable(Drawable who)` Called when the drawable needs to be redrawn.
`boolean` | `isAutoMirrored()` Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left.
`boolean` | `isStateful()` Indicates whether this drawable will change its appearance based on state.
`void` | `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.
`void` | `onBoundsChange(Rect bounds)` Override this in your subclass to change appearance if you vary based on the bounds.
`boolean` | `onLayoutDirectionChanged(int layoutDirection)` Called when the drawable's resolved layout direction changes.
`boolean` | `onLevelChange(int level)` Override this in your subclass to change appearance if you vary based on level.
`boolean` | `onStateChange(int[] state)` Override this in your subclass to change appearance if you recognize the specified state.
`void` | `scheduleDrawable(Drawable who, Runnable what, long when)` A Drawable can call this to schedule the next frame of its animation.
`void` | `setAlpha(int alpha)` Specify an alpha value for the drawable.
`void` | `setAutoMirrored(boolean mirrored)` Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left).
`void` | `setColorFilter(ColorFilter colorFilter)` Specify an optional color filter for the drawable.
`void` | `setDither(boolean dither)` This method is deprecated. This property is ignored.
`void` | `setDrawable(int index, Drawable drawable)` Sets the drawable for the layer at the specified index.
`boolean` | `setDrawableByLayerId(int id, Drawable drawable)` Replaces the `Drawable` for the layer with the given id.
`void` | `setHotspot(float x, float y)` Specifies the hotspot's location within the drawable.
`void` | `setHotspotBounds(int left, int top, int right, int bottom)` Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.
`void` | `setId(int index, int id)` Sets the ID of a layer.
`void` | `setLayerGravity(int index, int gravity)` Sets the gravity used to position or stretch the specified layer within its container.
`void` | `setLayerHeight(int index, int h)`
`void` | `setLayerInset(int index, int l, int t, int r, int b)` Specifies the insets in pixels for the drawable at the specified index.
`void` | `setLayerInsetBottom(int index, int b)`
`void` | `setLayerInsetEnd(int index, int e)`
`void` | `setLayerInsetLeft(int index, int l)`
`void` | `setLayerInsetRelative(int index, int s, int t, int e, int b)` Specifies the relative insets in pixels for the drawable at the specified index.
`void` | `setLayerInsetRight(int index, int r)`
`void` | `setLayerInsetStart(int index, int s)`
`void` | `setLayerInsetTop(int index, int t)`
`void` | `setLayerSize(int index, int w, int h)` Sets an explicit size for the specified layer.
`void` | `setLayerWidth(int index, int w)`
`void` | `setOpacity(int opacity)` Sets the opacity of this drawable directly instead of collecting the states from the layers.
`void` | `setPadding(int left, int top, int right, int bottom)` Sets the absolute padding.
`void` | `setPaddingMode(int mode)` Specifies how layer padding should affect the bounds of subsequent layers.
`void` | `setPaddingRelative(int start, int top, int end, int bottom)` Sets the relative padding.
`void` | `setTintBlendMode(BlendMode blendMode)` Specifies a tint blending mode for this drawable.
`void` | `setTintList(ColorStateList tint)` Specifies tint color for this drawable as a color state list.
`boolean` | `setVisible(boolean visible, boolean restart)` Set whether this Drawable is visible.
`void` | `unscheduleDrawable(Drawable who, Runnable what)` A Drawable can call this to unschedule an action previously scheduled with `scheduleDrawable(Drawable, Runnable, long)`.
From class `android.graphics.drawable.Drawable`
`void` | `applyTheme(Resources.Theme t)` Applies the specified theme to this Drawable and its children.
`boolean` | `canApplyTheme()`
`void` | `clearColorFilter()` Removes the color filter for this drawable.
`final Rect` | `copyBounds()` Return a copy of the drawable's bounds in a new Rect.
`final void` | `copyBounds(Rect bounds)` Return a copy of the drawable's bounds in the specified Rect (allocated by the caller).
`static Drawable` | `createFromPath(String pathName)` Create a drawable from file path name.
`static Drawable` | `createFromResourceStream(Resources res, TypedValue value, InputStream is, String srcName, BitmapFactory.Options opts)` This method is deprecated. Prefer the version without an Options object.
`static Drawable` | `createFromResourceStream(Resources res, TypedValue value, InputStream is, String srcName)` Create a drawable from an inputstream, using the given resources and value to determine density information.
`static Drawable` | `createFromStream(InputStream is, String srcName)` Create a drawable from an inputstream
`static Drawable` | `createFromXml(Resources r, XmlPullParser parser)` Create a drawable from an XML document.
`static Drawable` | `createFromXml(Resources r, XmlPullParser parser, Resources.Theme theme)` Create a drawable from an XML document using an optional `Theme`.
`static Drawable` | `createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)` Create a drawable from inside an XML document using an optional `Theme`.
`static Drawable` | `createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs)` Create from inside an XML document.
`abstract void` | `draw(Canvas canvas)` Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).
`int` | `getAlpha()` Gets the current alpha value for the drawable.
`final Rect` | `getBounds()` Return the drawable's bounds Rect.
`Drawable.Callback` | `getCallback()` Return the current `Callback` implementation attached to this Drawable.
`int` | `getChangingConfigurations()` Return a mask of the configuration parameters for which this drawable may change, requiring that it be re-created.
`ColorFilter` | `getColorFilter()` Returns the current color filter, or `null` if none set.
`Drawable.ConstantState` | `getConstantState()` Return a `ConstantState` instance that holds the shared state of this Drawable.
`Drawable` | `getCurrent()`
`Rect` | `getDirtyBounds()` Return the drawable's dirty bounds Rect.
`void` | `getHotspotBounds(Rect outRect)` Populates `outRect` with the hotspot bounds.
`int` | `getIntrinsicHeight()` Returns the drawable's intrinsic height.
`int` | `getIntrinsicWidth()` Returns the drawable's intrinsic width.
`int` | `getLayoutDirection()` Returns the resolved layout direction for this Drawable.
`final int` | `getLevel()` Retrieve the current level.
`int` | `getMinimumHeight()` Returns the minimum height suggested by this Drawable.
`int` | `getMinimumWidth()` Returns the minimum width suggested by this Drawable.
`abstract int` | `getOpacity()` This method is deprecated. This method is no longer used in graphics optimizations
`Insets` | `getOpticalInsets()` Return in insets the layout insets suggested by this Drawable for use with alignment operations during layout.
`void` | `getOutline(Outline outline)` Called to get the drawable to populate the Outline that defines its drawing area.
`boolean` | `getPadding(Rect padding)` Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds.
`int[]` | `getState()` Describes the current state, as a union of primitve states, such as `R.attr.state_focused`, `R.attr.state_selected`, etc.
`Region` | `getTransparentRegion()` Returns a Region representing the part of the Drawable that is completely transparent.
`void` | `inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme)` Inflate this Drawable from an XML resource optionally styled by a theme.
`void` | `inflate(Resources r, XmlPullParser parser, AttributeSet attrs)` Inflate this Drawable from an XML resource.
`void` | `invalidateSelf()` Use the current `Callback` implementation to have this Drawable redrawn.
`boolean` | `isAutoMirrored()` Tells if this Drawable will be automatically mirrored when its layout direction is RTL right-to-left.
`boolean` | `isFilterBitmap()`
`boolean` | `isProjected()` Whether this drawable requests projection.
`boolean` | `isStateful()` Indicates whether this drawable will change its appearance based on state.
`final boolean` | `isVisible()`
`void` | `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.
`void` | `onBoundsChange(Rect bounds)` Override this in your subclass to change appearance if you vary based on the bounds.
`boolean` | `onLayoutDirectionChanged(int layoutDirection)` Called when the drawable's resolved layout direction changes.
`boolean` | `onLevelChange(int level)` Override this in your subclass to change appearance if you vary based on level.
`boolean` | `onStateChange(int[] state)` Override this in your subclass to change appearance if you recognize the specified state.
`static int` | `resolveOpacity(int op1, int op2)` Return the appropriate opacity value for two source opacities.
`void` | `scheduleSelf(Runnable what, long when)` Use the current `Callback` implementation to have this Drawable scheduled.
`abstract void` | `setAlpha(int alpha)` Specify an alpha value for the drawable.
`void` | `setAutoMirrored(boolean mirrored)` Set whether this Drawable is automatically mirrored when its layout direction is RTL (right-to left).
`void` | `setBounds(int left, int top, int right, int bottom)` Specify a bounding rectangle for the Drawable.
`void` | `setBounds(Rect bounds)` Specify a bounding rectangle for the Drawable.
`final void` | `setCallback(Drawable.Callback cb)` Bind a `Callback` object to this Drawable.
`void` | `setChangingConfigurations(int configs)` Set a mask of the configuration parameters for which this drawable may change, requiring that it be re-created.
`void` | `setColorFilter(int color, PorterDuff.Mode mode)` This method is deprecated. use `setColorFilter(android.graphics.ColorFilter)` with an instance of `BlendModeColorFilter`
`abstract void` | `setColorFilter(ColorFilter colorFilter)` Specify an optional color filter for the drawable.
`void` | `setDither(boolean dither)` This method is deprecated. This property is ignored.
`void` | `setFilterBitmap(boolean filter)` Set to true to have the drawable filter its bitmaps with bilinear sampling when they are scaled or rotated.
`void` | `setHotspot(float x, float y)` Specifies the hotspot's location within the drawable.
`void` | `setHotspotBounds(int left, int top, int right, int bottom)` Sets the bounds to which the hotspot is constrained, if they should be different from the drawable bounds.
`final boolean` | `setLayoutDirection(int layoutDirection)` Set the layout direction for this drawable.
`final boolean` | `setLevel(int level)` Specify the level for the drawable.
`boolean` | `setState(int[] stateSet)` Specify a set of states for the drawable.
`void` | `setTint(int tintColor)` Specifies tint color for this drawable.
`void` | `setTintBlendMode(BlendMode blendMode)` Specifies a tint blending mode for this drawable.
`void` | `setTintList(ColorStateList tint)` Specifies tint color for this drawable as a color state list.
`void` | `setTintMode(PorterDuff.Mode tintMode)` Specifies a tint blending mode for this drawable.
`boolean` | `setVisible(boolean visible, boolean restart)` Set whether this Drawable is visible.
`void` | `unscheduleSelf(Runnable what)` Use the current `Callback` implementation to have this Drawable unscheduled.
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.graphics.drawable.Drawable.Callback`
`abstract void` | `invalidateDrawable(Drawable who)` Called when the drawable needs to be redrawn.
`abstract void` | `scheduleDrawable(Drawable who, Runnable what, long when)` A Drawable can call this to schedule the next frame of its animation.
`abstract void` | `unscheduleDrawable(Drawable who, Runnable what)` A Drawable can call this to unschedule an action previously scheduled with `scheduleDrawable(Drawable, Runnable, long)`.

## XML attributes

### android:color

The color to use for ripple effects. This attribute is required.

May be a color value, in the form of "`#rgb`", "`#argb`", "`#rrggbb`", or "`#aarrggbb`".

Related methods:

- `setColor(ColorStateList)`

### android:radius

The radius of the ripple when fully expanded. By default, the radius is computed based on the size of the ripple's container.

May be a dimension value, which is a floating point number appended with a unit such as "`14.5sp`". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).

Related methods:

- `setRadius(int)`

## Constants

### RADIUS_AUTO

    public static final int RADIUS_AUTO

Radius value that specifies the ripple radius should be computed based on the size of the ripple's container.

Constant Value: -1 (0xffffffff)

## Public constructors

### RippleDrawable

    public RippleDrawable (ColorStateList color,
                    Drawable content,
                    Drawable mask)

Creates a new ripple drawable with the specified ripple color and optional content and mask drawables.

Parameters
`color` | `ColorStateList`: The ripple color This value cannot be `null`.
`content` | `Drawable`: The content drawable, may be `null` This value may be `null`.
`mask` | `Drawable`: The mask drawable, may be `null` This value may be `null`.

## Public methods

### applyTheme

    public void applyTheme (Resources.Theme t)

Applies the specified theme to this Drawable and its children.

Parameters
`t` | `Resources.Theme`: This value cannot be `null`.

### canApplyTheme

    public boolean canApplyTheme ()

Returns
`boolean` |

### draw

    public void draw (Canvas canvas)

Optimized for drawing ripples with a mask layer and optional content.

Parameters
`canvas` | `Canvas`: This value cannot be `null`.

### getConstantState

    public Drawable.ConstantState getConstantState ()

Return a `ConstantState` instance that holds the shared state of this Drawable.

Returns
`Drawable.ConstantState` | The ConstantState associated to that Drawable. This value may be `null`.

### getDirtyBounds

    public Rect getDirtyBounds ()

Return the drawable's dirty bounds Rect. Note: for efficiency, the returned object may be the same object stored in the drawable (though this is not guaranteed).

By default, this returns the full drawable bounds. Custom drawables may override this method to perform more precise invalidation.

Returns
`Rect` | The dirty bounds of this drawable This value cannot be `null`.

### getHotspotBounds

    public void getHotspotBounds (Rect outRect)

Populates `outRect` with the hotspot bounds.

Parameters
`outRect` | `Rect`: the rect to populate with the hotspot bounds This value cannot be `null`.

### getOpacity

    public int getOpacity ()

This method is deprecated.
This method is no longer used in graphics optimizations

Return the opacity/transparency of this Drawable. The returned value is one of the abstract format constants in `PixelFormat`: `PixelFormat.UNKNOWN`, `PixelFormat.TRANSLUCENT`, `PixelFormat.TRANSPARENT`, or `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(int, int)` 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(int)` or `setColorFilter(ColorFilter)` methods. Some subclasses, such as `BitmapDrawable`, `ColorDrawable`, and `GradientDrawable`, do account for the value of `setAlpha(int)`, but the general behavior is dependent upon the implementation of the subclass.

Returns
`int` | int The opacity class of the Drawable. Value is `PixelFormat.UNKNOWN`, `PixelFormat.TRANSLUCENT`, `PixelFormat.TRANSPARENT`, or `PixelFormat.OPAQUE`

### getOutline

    public void getOutline (Outline outline)

Populates `outline` with the first available layer outline, excluding the mask layer.

Parameters
`outline` | `Outline`: Outline in which to place the first available layer outline This value cannot be `null`.

### getRadius

    public int getRadius ()

Related XML Attributes:

- android:radius

Returns
`int` | the radius in pixels of the fully expanded ripple if an explicit radius has been set, or `RADIUS_AUTO` if the radius is computed based on the container size

### inflate

    public void inflate (Resources r,
                    XmlPullParser parser,
                    AttributeSet attrs,
                    Resources.Theme 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.

Parameters
`r` | `Resources`: This value cannot be `null`.
`parser` | `XmlPullParser`: This value cannot be `null`.
`attrs` | `AttributeSet`: This value cannot be `null`.
`theme` | `Resources.Theme`: This value may be `null`.

Throws
`IOException` |
`XmlPullParserException` |

### invalidateSelf

    public void invalidateSelf ()

Use the current `Callback` implementation to have this Drawable redrawn. Does nothing if there is no Callback attached to the Drawable.

### isStateful

    public 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.

Returns
`boolean` | True if this drawable changes its appearance based on state, false otherwise.

### jumpToCurrentState

    public void jumpToCurrentState ()

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

### mutate

    public 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.

Returns
`Drawable` | This drawable. This value cannot be `null`.

### setColor

    public void setColor (ColorStateList color)

Sets the ripple color.

Related XML Attributes:

- android:color

Parameters
`color` | `ColorStateList`: Ripple color as a color state list.

### setDrawableByLayerId

    public boolean setDrawableByLayerId (int id,
                    Drawable drawable)

Replaces the `Drawable` for the layer with the given id.

Parameters
`id` | `int`: The layer ID to search for.
`drawable` | `Drawable`: The replacement `Drawable`.

Returns
`boolean` | Whether the `Drawable` was replaced (could return false if the id was not found).

### setHotspot

    public void setHotspot (float x,
                    float y)

Specifies the hotspot's location within the drawable.

Parameters
`x` | `float`: The X coordinate of the center of the hotspot
`y` | `float`: The Y coordinate of the center of the hotspot

### setHotspotBounds

    public void setHotspotBounds (int left,
                    int top,
                    int right,
                    int bottom)

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

Parameters
`left` | `int`: position in pixels of the left bound
`top` | `int`: position in pixels of the top bound
`right` | `int`: position in pixels of the right bound
`bottom` | `int`: position in pixels of the bottom bound

### setPaddingMode

    public void setPaddingMode (int mode)

Specifies how layer padding should affect the bounds of subsequent layers. The default and recommended value for RippleDrawable is `LayerDrawable.PADDING_MODE_STACK`.

Parameters
`mode` | `int`: padding mode, one of: `LayerDrawable.PADDING_MODE_NEST` to nest each layer inside the padding of the previous layer `LayerDrawable.PADDING_MODE_STACK` to stack each layer directly atop the previous layer

See also:

- `LayerDrawable.getPaddingMode()`

### setRadius

    public void setRadius (int radius)

Sets the radius in pixels of the fully expanded ripple.

Related XML Attributes:

- android:radius

Parameters
`radius` | `int`: ripple radius in pixels, or `RADIUS_AUTO` to compute the radius based on the container size

### setVisible

    public boolean setVisible (boolean visible,
                    boolean restart)

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.

Parameters
`visible` | `boolean`: Set to true if visible, false if not.
`restart` | `boolean`: You can supply true here to force the drawable to behave as if it has just become visible, even if it had last been set visible. Used for example to force animations to restart.

Returns
`boolean` | boolean Returns true if the new visibility is different than its previous state.

## Protected methods

### onBoundsChange

    protected void onBoundsChange (Rect bounds)

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

Parameters
`bounds` | `Rect`

### onStateChange

    protected boolean onStateChange (int[] stateSet)

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

Parameters
`stateSet` | `int`

Returns
`boolean` | Returns true if the state change has caused the appearance of the Drawable to change (that is, it needs to be drawn), else false if it looks the same and there is no need to redraw it since its last state.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*