public class IconDrawable
extends android.graphics.drawable.Drawable
new IconDrawable(context, IconValue.icon_star)
.colorRes(R.color.white)
.actionBarSize();
If you don't set the size of the drawable, it will use the size
that is given to him. Note that in an ActionBar, if you don't
set the size explicitly it uses 0, so please use actionBarSize().| Modifier and Type | Field and Description |
|---|---|
static int |
ANDROID_ACTIONBAR_ICON_SIZE_DP |
| Constructor and Description |
|---|
IconDrawable(android.content.Context context,
Icon icon)
Create an IconDrawable.
|
IconDrawable(android.content.Context context,
java.lang.String iconKey)
Create an IconDrawable.
|
| Modifier and Type | Method and Description |
|---|---|
IconDrawable |
actionBarSize()
Set the size of this icon to the standard Android ActionBar.
|
IconDrawable |
alpha(int alpha)
Set the alpha of this drawable.
|
void |
clearColorFilter() |
IconDrawable |
color(int color)
Set the color of the drawable.
|
IconDrawable |
colorRes(int colorRes)
Set the color of the drawable.
|
void |
draw(android.graphics.Canvas canvas) |
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getOpacity() |
boolean |
isStateful() |
void |
setAlpha(int alpha) |
void |
setColorFilter(android.graphics.ColorFilter cf) |
boolean |
setState(int[] stateSet) |
void |
setStyle(android.graphics.Paint.Style style)
Sets paint style.
|
IconDrawable |
sizeDp(int size)
Set the size of the drawable.
|
IconDrawable |
sizePx(int size)
Set the size of the drawable.
|
IconDrawable |
sizeRes(int dimenRes)
Set the size of the drawable.
|
applyTheme, canApplyTheme, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getAlpha, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getDirtyBounds, getLevel, getMinimumHeight, getMinimumWidth, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isVisible, jumpToCurrentState, mutate, onBoundsChange, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLevel, setTint, setTintList, setTintMode, setVisible, unscheduleSelfpublic static final int ANDROID_ACTIONBAR_ICON_SIZE_DP
public IconDrawable(android.content.Context context,
java.lang.String iconKey)
context - Your activity or application context.iconKey - The icon key you want this drawable to display.java.lang.IllegalArgumentException - if the key doesn't match any icon.public IconDrawable(android.content.Context context,
Icon icon)
context - Your activity or application context.icon - The icon you want this drawable to display.public IconDrawable actionBarSize()
public IconDrawable sizeRes(int dimenRes)
dimenRes - The dimension resource.public IconDrawable sizeDp(int size)
size - The size in density-independent pixels (dp).public IconDrawable sizePx(int size)
size - The size in pixels (px).public IconDrawable color(int color)
color - The color, usually from android.graphics.Color or 0xFF012345.public IconDrawable colorRes(int colorRes)
colorRes - The color resource, from your R file.public IconDrawable alpha(int alpha)
alpha - The alpha, between 0 (transparent) and 255 (opaque).public int getIntrinsicHeight()
getIntrinsicHeight in class android.graphics.drawable.Drawablepublic int getIntrinsicWidth()
getIntrinsicWidth in class android.graphics.drawable.Drawablepublic void draw(android.graphics.Canvas canvas)
draw in class android.graphics.drawable.Drawablepublic boolean isStateful()
isStateful in class android.graphics.drawable.Drawablepublic boolean setState(int[] stateSet)
setState in class android.graphics.drawable.Drawablepublic void setAlpha(int alpha)
setAlpha in class android.graphics.drawable.Drawablepublic void setColorFilter(android.graphics.ColorFilter cf)
setColorFilter in class android.graphics.drawable.Drawablepublic void clearColorFilter()
clearColorFilter in class android.graphics.drawable.Drawablepublic int getOpacity()
getOpacity in class android.graphics.drawable.Drawablepublic void setStyle(android.graphics.Paint.Style style)
style - to be applied