ShadowDrawableWrapper

public class ShadowDrawableWrapper
extends DrawableWrapperCompat

java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ androidx.appcompat.graphics.drawable.DrawableWrapperCompat
       ↳ com.google.android.material.shadow.ShadowDrawableWrapper


This class is deprecated.
Use MaterialShapeDrawable instead.

A Drawable which wraps another drawable and draws a shadow around it.

Summary

Public constructors

ShadowDrawableWrapper(Context context, Drawable content, float radius, float shadowSize, float maxShadowSize)

Public methods

static float calculateHorizontalPadding(float maxShadowSize, float cornerRadius, boolean addPaddingForCorners)
static float calculateVerticalPadding(float maxShadowSize, float cornerRadius, boolean addPaddingForCorners)
void draw(Canvas canvas)
float getCornerRadius()
float getMaxShadowSize()
float getMinHeight()
float getMinWidth()
int getOpacity()
boolean getPadding(Rect padding)
float getShadowSize()
void setAddPaddingForCorners(boolean addPaddingForCorners)
void setAlpha(int alpha)
void setCornerRadius(float radius)
void setMaxShadowSize(float size)
final void setRotation(float rotation)
void setShadowSize(float size)
void setShadowSize(float shadowSize, float maxShadowSize)

Protected methods

void onBoundsChange(Rect bounds)

Inherited methods

Public constructors

ShadowDrawableWrapper

public ShadowDrawableWrapper (Context context, 
                Drawable content, 
                float radius, 
                float shadowSize, 
                float maxShadowSize)

Parameters
context Context

content Drawable

radius float

shadowSize float

maxShadowSize float

Public methods

calculateHorizontalPadding

public static float calculateHorizontalPadding (float maxShadowSize, 
                float cornerRadius, 
                boolean addPaddingForCorners)

Parameters
maxShadowSize float

cornerRadius float

addPaddingForCorners boolean

Returns
float

calculateVerticalPadding

public static float calculateVerticalPadding (float maxShadowSize, 
                float cornerRadius, 
                boolean addPaddingForCorners)

Parameters
maxShadowSize float

cornerRadius float

addPaddingForCorners boolean

Returns
float

draw

public void draw (Canvas canvas)

Parameters
canvas Canvas

getCornerRadius

public float getCornerRadius ()

Returns
float

getMaxShadowSize

public float getMaxShadowSize ()

Returns
float

getMinHeight

public float getMinHeight ()

Returns
float

getMinWidth

public float getMinWidth ()

Returns
float

getOpacity

public int getOpacity ()

Returns
int

getPadding

public boolean getPadding (Rect padding)

Parameters
padding Rect

Returns
boolean

getShadowSize

public float getShadowSize ()

Returns
float

setAddPaddingForCorners

public void setAddPaddingForCorners (boolean addPaddingForCorners)

Parameters
addPaddingForCorners boolean

setAlpha

public void setAlpha (int alpha)

Parameters
alpha int

setCornerRadius

public void setCornerRadius (float radius)

Parameters
radius float

setMaxShadowSize

public void setMaxShadowSize (float size)

Parameters
size float

setRotation

public final void setRotation (float rotation)

Parameters
rotation float

setShadowSize

public void setShadowSize (float size)

Parameters
size float

setShadowSize

public void setShadowSize (float shadowSize, 
                float maxShadowSize)

Parameters
shadowSize float

maxShadowSize float

Protected methods

onBoundsChange

protected void onBoundsChange (Rect bounds)

Parameters
bounds Rect