|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.graphics.drawable.Drawable
android.graphics.drawable.LayerDrawable
public class LayerDrawable
Drawable that manages an array of other drawables. These are drawn in array order, so the element with the largest index will be drawn on top.
| Nested Class Summary | |
|---|---|
(package private) static class |
LayerDrawable.LayerState
|
(package private) static class |
LayerDrawable.Rec
|
| Nested classes/interfaces inherited from class android.graphics.drawable.Drawable |
|---|
Drawable.Callback, Drawable.ConstantState |
| Field Summary | |
|---|---|
(package private) LayerDrawable.LayerState |
mLayerState
|
| Fields inherited from class android.graphics.drawable.Drawable |
|---|
mCallback |
| Constructor Summary | |
|---|---|
LayerDrawable()
|
|
LayerDrawable(Drawable[] array)
|
|
LayerDrawable(LayerDrawable.LayerState state)
|
|
| Method Summary | |
|---|---|
(package private) LayerDrawable.LayerState |
createConstantState(LayerDrawable.LayerState state)
|
void |
draw(Canvas canvas)
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter). |
Drawable |
findDrawableByLayerId(int id)
Look for a layer with the given id, and returns its Drawable. |
int |
getChangingConfigurations()
Return a mask of the configuration parameters for which this drawable mau change, requiring that it be re-created. |
Drawable.ConstantState |
getConstantState()
|
Drawable |
getDrawable(int index)
|
int |
getId(int index)
|
int |
getIntrinsicHeight()
Return the intrinsic height of the underlying drawable object. |
int |
getIntrinsicWidth()
Return the intrinsic width of the underlying drawable object. |
int |
getNumberOfLayers()
Returns the number of layers contained within this. |
int |
getOpacity()
Return the opacity/transparency of this Drawable. |
boolean |
getPadding(Rect padding)
Return in padding the insets suggested by this Drawable for placing content inside the drawable's bounds. |
void |
inflate(Resources r,
XmlPullParser parser,
AttributeSet attrs)
|
void |
invalidateDrawable(Drawable who)
Called when the drawable needs to be redrawn. |
boolean |
isStateful()
Indicates whether this view will change its appearance based on state. |
protected void |
onBoundsChange(Rect bounds)
Override this in your subclass to change appearance if you recognize the specified state. |
protected boolean |
onLevelChange(int level)
Override this in your subclass to change appearance if you vary based on level. |
protected boolean |
onStateChange(int[] state)
Override this in your subclass to change appearance if you recognize the specified state. |
void |
scheduleDrawable(Drawable who,
Runnable what,
long when)
A Drawable can call this to schedule the next frame of its animation. |
void |
setAlpha(int alpha)
Specify an alpha value for the drawable. |
void |
setColorFilter(ColorFilter cf)
Specify an optional colorFilter for the drawable. |
void |
setDither(boolean dither)
Set to true to have the drawable dither its colors when drawn to a device with fewer than 8-bits per color component. |
boolean |
setDrawableByLayerId(int id,
Drawable drawable)
Sets (or replaces) the Drawable for the layer with the given id. |
void |
setId(int index,
int id)
Sets the ID of a layer. |
void |
setLayerInset(int index,
int l,
int t,
int r,
int b)
Specify modifiers to the bounds for the drawable[index]. |
boolean |
setVisible(boolean visible,
boolean restart)
Set whether this Drawable is visible. |
void |
unscheduleDrawable(Drawable who,
Runnable what)
A Drawable can call this to unschedule an action previously scheduled with Drawable.Callback.scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long). |
| Methods inherited from class android.graphics.drawable.Drawable |
|---|
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromStream, createFromXml, createFromXmlInner, getBounds, getCurrent, getLevel, getMinimumHeight, getMinimumWidth, getState, getTransparentRegion, inflateWithAttributes, invalidateSelf, isVisible, resolveOpacity, scheduleSelf, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setFilterBitmap, setLevel, setState, unscheduleSelf |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
LayerDrawable.LayerState mLayerState
| Constructor Detail |
|---|
public LayerDrawable(Drawable[] array)
LayerDrawable()
LayerDrawable(LayerDrawable.LayerState state)
| Method Detail |
|---|
LayerDrawable.LayerState createConstantState(LayerDrawable.LayerState state)
public void inflate(Resources r,
XmlPullParser parser,
AttributeSet attrs)
throws XmlPullParserException,
IOException
inflate in class DrawableXmlPullParserException
IOExceptionpublic Drawable findDrawableByLayerId(int id)
Drawable.
id - The layer ID to search for.
Drawable of the layer that has the given id in the hierarchy or null.
public void setId(int index,
int id)
index - The index of the layer which will received the ID.id - The ID to assign to the layer.public int getNumberOfLayers()
public Drawable getDrawable(int index)
public int getId(int index)
public boolean setDrawableByLayerId(int id,
Drawable drawable)
Drawable for the layer with the given id.
id - The layer ID to search for.drawable - The replacement Drawable.
Drawable was replaced (could return false if
the id was not found).
public void setLayerInset(int index,
int l,
int t,
int r,
int b)
public void invalidateDrawable(Drawable who)
Drawable.Callback
invalidateDrawable in interface Drawable.Callbackwho - The drawable that is requesting the update.
public void scheduleDrawable(Drawable who,
Runnable what,
long when)
Drawable.CallbackHandler.postAtTime(Runnable, Object, long) with
the parameters (what, who, when) to perform the
scheduling.
scheduleDrawable in interface Drawable.Callbackwho - The drawable being scheduled.what - The action to execute.when - The time (in milliseconds) to run. The timebase is
SystemClock.uptimeMillis()
public void unscheduleDrawable(Drawable who,
Runnable what)
Drawable.CallbackDrawable.Callback.scheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable, long). An implementation can
generally simply call
Handler.removeCallbacks(Runnable, Object) with
the parameters (what, who) to unschedule the drawable.
unscheduleDrawable in interface Drawable.Callbackwho - The drawable being unscheduled.what - The action being unscheduled.public void draw(Canvas canvas)
Drawable
draw in class Drawablecanvas - The canvas to draw intopublic int getChangingConfigurations()
DrawableDrawable.setChangingConfigurations(int) or 0 by default. Subclasses
may extend this to or in the changing configurations of any other
drawables they hold.
getChangingConfigurations in class DrawableConfiguration.Configurationpublic boolean getPadding(Rect padding)
Drawable
getPadding in class Drawable
public boolean setVisible(boolean visible,
boolean restart)
Drawable
setVisible in class Drawablevisible - Set to true if visible, false if not.restart - You can supply true here to force the drawable to behave
as if it has just become visible, even if it had last
been set visible. Used for example to force animations
to restart.
public void setDither(boolean dither)
Drawable
setDither in class Drawablepublic void setAlpha(int alpha)
Drawable
setAlpha in class Drawablepublic void setColorFilter(ColorFilter cf)
Drawable
setColorFilter in class Drawablepublic int getOpacity()
DrawablePixelFormat:
PixelFormat.UNKNOWN,
PixelFormat.TRANSLUCENT,
PixelFormat.TRANSPARENT, or
PixelFormat.OPAQUE.
Generally a Drawable should be as conservative as possible with the
value it returns. For example, if it contains multiple child drawables
and only shows one of them at a time, if only one of the children is
TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be
returned. You can use the method Drawable.resolveOpacity(int, int) to perform a
standard reduction of two opacities to the appropriate single output.
Note that the returned value does not take into account a
custom alpha or color filter that has been applied by the client through
the Drawable.setAlpha(int) or Drawable.setColorFilter(android.graphics.ColorFilter) methods.
getOpacity in class DrawablePixelFormatpublic boolean isStateful()
Drawable
isStateful in class DrawableDrawable.setState(int[])protected boolean onStateChange(int[] state)
Drawable
onStateChange in class Drawableprotected boolean onLevelChange(int level)
Drawable
onLevelChange in class Drawableprotected void onBoundsChange(Rect bounds)
Drawable
onBoundsChange in class Drawablepublic int getIntrinsicWidth()
Drawable
getIntrinsicWidth in class Drawablepublic int getIntrinsicHeight()
Drawable
getIntrinsicHeight in class Drawablepublic Drawable.ConstantState getConstantState()
getConstantState in class Drawable
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||