android.graphics.drawable.LevelListDrawable
A resource that contains a number of alternate images, each assigned a maximum numerical value.
Setting the level value of the object with setLevel(int) will load the image with the next
greater or equal value assigned to its max attribute. See
Level List in the Resources topic to learn how to specify this type as an XML resource. A good example use of
a LevelListDrawable would be a battery level indicator icon, with different images to indicate the current
battery level.
Summary
Public Constructors
Public Methods
Protected Methods
draw,
getChangingConfigurations,
getConstantState,
getCurrent,
getIntrinsicHeight,
getIntrinsicWidth,
getMinimumHeight,
getMinimumWidth,
getOpacity,
getPadding,
invalidateDrawable,
isStateful,
onBoundsChange,
onLevelChange,
onStateChange,
scheduleDrawable,
selectDrawable,
setAlpha,
setColorFilter,
setConstantState,
setDither,
setVisible,
unscheduleDrawable
clearColorFilter,
copyBounds,
copyBounds,
createFromPath,
createFromStream,
createFromXml,
createFromXmlInner,
draw,
getBounds,
getChangingConfigurations,
getConstantState,
getCurrent,
getIntrinsicHeight,
getIntrinsicWidth,
getLevel,
getMinimumHeight,
getMinimumWidth,
getOpacity,
getPadding,
getState,
getTransparentRegion,
inflate,
invalidateSelf,
isStateful,
isVisible,
onBoundsChange,
onLevelChange,
onStateChange,
resolveOpacity,
scheduleSelf,
setAlpha,
setBounds,
setBounds,
setCallback,
setChangingConfigurations,
setColorFilter,
setColorFilter,
setDither,
setFilterBitmap,
setLevel,
setState,
setVisible,
unscheduleSelf
|
|
|
|
|
void |
clearColorFilter() |
|
|
final |
|
|
Rect |
copyBounds() |
|
|
final |
|
|
void |
copyBounds(Rect bounds) |
|
|
|
static |
|
Drawable |
createFromPath(String pathName) |
|
|
|
static |
|
Drawable |
createFromStream(InputStream is, String srcName) |
|
|
|
static |
|
Drawable |
createFromXml(Resources r, XmlPullParser parser) |
|
|
|
static |
|
Drawable |
createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs) |
abstract |
|
|
|
|
void |
draw(Canvas canvas) |
|
|
final |
|
|
Rect |
getBounds() |
|
|
|
|
|
int |
getChangingConfigurations() |
|
|
|
|
|
Drawable.ConstantState |
getConstantState() |
|
|
|
|
|
Drawable |
getCurrent() |
|
|
|
|
|
int |
getIntrinsicHeight() |
|
|
|
|
|
int |
getIntrinsicWidth() |
|
|
final |
|
|
int |
getLevel() |
|
|
|
|
|
int |
getMinimumHeight() |
|
|
|
|
|
int |
getMinimumWidth() |
abstract |
|
|
|
|
int |
getOpacity() |
|
|
|
|
|
boolean |
getPadding(Rect padding) |
|
|
|
|
|
int[] |
getState() |
|
|
|
|
|
Region |
getTransparentRegion() |
|
|
|
|
|
void |
inflate(Resources r, XmlPullParser parser, AttributeSet attrs) |
|
|
|
|
|
void |
invalidateSelf() |
|
|
|
|
|
boolean |
isStateful() |
|
|
final |
|
|
boolean |
isVisible() |
|
|
|
|
|
void |
onBoundsChange(Rect bounds) |
|
|
|
|
|
boolean |
onLevelChange(int level) |
|
|
|
|
|
boolean |
onStateChange(int[] state) |
|
|
|
static |
|
int |
resolveOpacity(int op1, int op2) |
|
|
|
|
|
void |
scheduleSelf(Runnable what, long when) |
abstract |
|
|
|
|
void |
setAlpha(int alpha) |
|
|
|
|
|
void |
setBounds(Rect bounds) |
|
|
|
|
|
void |
setBounds(int left, int top, int right, int bottom) |
|
|
final |
|
|
void |
setCallback(Drawable.Callback cb) |
|
|
|
|
|
void |
setChangingConfigurations(int configs) |
abstract |
|
|
|
|
void |
setColorFilter(ColorFilter cf) |
|
|
|
|
|
void |
setColorFilter(int color, PorterDuff.Mode mode) |
|
|
|
|
|
void |
setDither(boolean dither) |
|
|
|
|
|
void |
setFilterBitmap(boolean filter) |
|
|
final |
|
|
boolean |
setLevel(int level) |
|
|
|
|
|
boolean |
setState(int[] stateSet) |
|
|
|
|
|
boolean |
setVisible(boolean visible, boolean restart) |
|
|
|
|
|
void |
unscheduleSelf(Runnable what) |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
LevelListDrawable()
Public Methods
public
void
addLevel(int low, int high, Drawable drawable)
Protected Methods
protected
boolean
onLevelChange(int level)
Override this in your subclass to change appearance if you vary based
on level.