public class PaddedDrawableWrapper
extends android.graphics.drawable.Drawable
Constructor and Description |
---|
PaddedDrawableWrapper(android.graphics.drawable.Drawable wrappedDrawable) |
PaddedDrawableWrapper(android.graphics.drawable.Drawable wrappedDrawable,
float xScalar,
float yScalar)
Instantiates a wrapper with the necessary amount of padding to make the given point on the
wrapped Drawable the center of the wrapper.
|
PaddedDrawableWrapper(android.graphics.drawable.Drawable wrappedDrawable,
int leftPadding,
int topPadding,
int rightPadding,
int bottomPadding)
Instantiates a wrapper with the given padding, given in pixels.
|
Modifier and Type | Method and Description |
---|---|
protected static int |
calculateBottomPadding(int height,
float yScalar) |
protected static int |
calculateLeftPadding(int width,
float xScalar) |
protected static int |
calculateRightPadding(int width,
float xScalar) |
protected static int |
calculateTopPadding(int height,
float yScalar) |
void |
draw(android.graphics.Canvas canvas) |
android.graphics.drawable.Drawable.ConstantState |
getConstantState() |
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getMinimumHeight() |
int |
getMinimumWidth() |
int |
getOpacity() |
android.graphics.drawable.Drawable |
getWrappedDrawable() |
float |
getXScalar() |
float |
getYScalar() |
void |
setAlpha(int alpha) |
void |
setBounds(android.graphics.Rect bounds) |
void |
setColorFilter(android.graphics.ColorFilter colorFilter) |
void |
updatePadding(float x,
float y)
Set the padding to values calculated to make the given coordinates the center of the wrapper.
|
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getAlpha, getBounds, getCallback, getChangingConfigurations, getColorFilter, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isStateful, isVisible, jumpToCurrentState, mutate, onBoundsChange, onLayoutDirectionChanged, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintList, setTintMode, setVisible, unscheduleSelf
public PaddedDrawableWrapper(android.graphics.drawable.Drawable wrappedDrawable)
public PaddedDrawableWrapper(android.graphics.drawable.Drawable wrappedDrawable, float xScalar, float yScalar)
xScalar
- Distance from the wrapped Drawable's left edge to use as the center of the
wrapper Drawable, given as a number between 0.0 and 1.0.yScalar
- Distance from the wrapped Drawable's top edge to use as the center of the
wrapper Drawable, given as a number between 0.0 and 1.0.public PaddedDrawableWrapper(android.graphics.drawable.Drawable wrappedDrawable, int leftPadding, int topPadding, int rightPadding, int bottomPadding)
public void setBounds(android.graphics.Rect bounds)
setBounds
in class android.graphics.drawable.Drawable
public void draw(android.graphics.Canvas canvas)
draw
in class android.graphics.drawable.Drawable
public void setAlpha(int alpha)
setAlpha
in class android.graphics.drawable.Drawable
public void setColorFilter(android.graphics.ColorFilter colorFilter)
setColorFilter
in class android.graphics.drawable.Drawable
public int getOpacity()
getOpacity
in class android.graphics.drawable.Drawable
public int getIntrinsicHeight()
getIntrinsicHeight
in class android.graphics.drawable.Drawable
public int getIntrinsicWidth()
getIntrinsicWidth
in class android.graphics.drawable.Drawable
public int getMinimumHeight()
getMinimumHeight
in class android.graphics.drawable.Drawable
public int getMinimumWidth()
getMinimumWidth
in class android.graphics.drawable.Drawable
public android.graphics.drawable.Drawable.ConstantState getConstantState()
getConstantState
in class android.graphics.drawable.Drawable
public void updatePadding(float x, float y)
public float getXScalar()
public float getYScalar()
protected static int calculateLeftPadding(int width, float xScalar)
protected static int calculateTopPadding(int height, float yScalar)
protected static int calculateRightPadding(int width, float xScalar)
protected static int calculateBottomPadding(int height, float yScalar)
public android.graphics.drawable.Drawable getWrappedDrawable()