Build 1.0_r1(from source)

android.graphics.drawable
Class StateListDrawable

java.lang.Object
  extended by android.graphics.drawable.Drawable
      extended by android.graphics.drawable.DrawableContainer
          extended by android.graphics.drawable.StateListDrawable
All Implemented Interfaces:
Drawable.Callback

public class StateListDrawable
extends DrawableContainer

Lets you assign a number of graphic images to a single Drawable and swap out the visible item by a string ID value.


Nested Class Summary
(package private) static class StateListDrawable.StateListState
           
 
Nested classes/interfaces inherited from class android.graphics.drawable.DrawableContainer
DrawableContainer.DrawableContainerState
 
Nested classes/interfaces inherited from class android.graphics.drawable.Drawable
Drawable.Callback, Drawable.ConstantState
 
Field Summary
 
Fields inherited from class android.graphics.drawable.Drawable
mCallback
 
Constructor Summary
StateListDrawable()
           
 
Method Summary
 void addState(int[] stateSet, Drawable drawable)
          Add a new image/string ID to the set of images.
(package private)  StateListDrawable.StateListState getStateListState()
           
 void inflate(Resources r, XmlPullParser parser, AttributeSet attrs)
           
 boolean isStateful()
          Indicates whether this view will change its appearance based on state.
protected  boolean onStateChange(int[] stateSet)
          Override this in your subclass to change appearance if you recognize the specified state.
 
Methods inherited from class android.graphics.drawable.DrawableContainer
draw, getChangingConfigurations, getConstantState, getCurrent, getIntrinsicHeight, getIntrinsicWidth, getMinimumHeight, getMinimumWidth, getOpacity, getPadding, invalidateDrawable, onBoundsChange, onLevelChange, scheduleDrawable, selectDrawable, setAlpha, setColorFilter, setConstantState, setDither, setVisible, unscheduleDrawable
 
Methods inherited from class android.graphics.drawable.Drawable
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromStream, createFromXml, createFromXmlInner, getBounds, getLevel, 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
 

Constructor Detail

StateListDrawable

public StateListDrawable()
Method Detail

addState

public void addState(int[] stateSet,
                     Drawable drawable)
Add a new image/string ID to the set of images.

Parameters:
stateSet - - An array of resource Ids to associate with the image. Switch to this image by calling setState().
drawable - -The image to show.

isStateful

public boolean isStateful()
Description copied from class: Drawable
Indicates whether this view will change its appearance based on state. Clients can use this to determine whether it is necessary to calculate their state and call setState.

Overrides:
isStateful in class DrawableContainer
Returns:
True if this view changes its appearance based on state, false otherwise.
See Also:
Drawable.setState(int[])

onStateChange

protected boolean onStateChange(int[] stateSet)
Description copied from class: Drawable
Override this in your subclass to change appearance if you recognize the specified state.

Overrides:
onStateChange in class DrawableContainer
Returns:
Returns true if the state change has caused the appearance of the Drawable to change (that is, it needs to be drawn), else false if it looks the same and there is no need to redraw it since its last state.

inflate

public void inflate(Resources r,
                    XmlPullParser parser,
                    AttributeSet attrs)
             throws XmlPullParserException,
                    IOException
Overrides:
inflate in class Drawable
Throws:
XmlPullParserException
IOException

getStateListState

StateListDrawable.StateListState getStateListState()

Build 1.0_r1(from source)

Please submit a feedback, bug or feature