public class ReactViewBackgroundDrawable
extends android.graphics.drawable.Drawable
Drawable
used for background of ReactViewGroup
. It supports
drawing background color and borders (including rounded borders) by providing a react friendly
API (setter for each of those properties).
The implementation tries to allocate as few objects as possible depending on which properties are
set. E.g. for views with rounded background/borders we allocate mPathForBorderRadius
and
mTempRectForBorderRadius
. In case when view have a rectangular borders we allocate
mBorderWidthResult
and similar. When only background color is set we won't allocate any
extra/unnecessary objects.Constructor and Description |
---|
ReactViewBackgroundDrawable() |
Modifier and Type | Method and Description |
---|---|
void |
draw(android.graphics.Canvas canvas) |
int |
getAlpha() |
int |
getColor() |
int |
getOpacity() |
void |
getOutline(android.graphics.Outline outline) |
protected void |
onBoundsChange(android.graphics.Rect bounds) |
void |
setAlpha(int alpha) |
void |
setBorderColor(int position,
float rgb,
float alpha) |
void |
setBorderStyle(java.lang.String style) |
void |
setBorderWidth(int position,
float width) |
void |
setColor(int color) |
void |
setColorFilter(android.graphics.ColorFilter cf) |
void |
setRadius(float radius) |
void |
setRadius(float radius,
int position) |
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getIntrinsicHeight, getIntrinsicWidth, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isStateful, isVisible, jumpToCurrentState, mutate, onLayoutDirectionChanged, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintList, setTintMode, setVisible, unscheduleSelf
public void draw(android.graphics.Canvas canvas)
draw
in class android.graphics.drawable.Drawable
protected void onBoundsChange(android.graphics.Rect bounds)
onBoundsChange
in class android.graphics.drawable.Drawable
public void setAlpha(int alpha)
setAlpha
in class android.graphics.drawable.Drawable
public int getAlpha()
getAlpha
in class android.graphics.drawable.Drawable
public void setColorFilter(android.graphics.ColorFilter cf)
setColorFilter
in class android.graphics.drawable.Drawable
public int getOpacity()
getOpacity
in class android.graphics.drawable.Drawable
public void getOutline(android.graphics.Outline outline)
getOutline
in class android.graphics.drawable.Drawable
public void setBorderWidth(int position, float width)
public void setBorderColor(int position, float rgb, float alpha)
public void setBorderStyle(@Nullable java.lang.String style)
public void setRadius(float radius)
public void setRadius(float radius, int position)
public void setColor(int color)
public int getColor()