English | Site Directory

Android - An Open Handset Alliance Project

android.graphics.drawable.StateListDrawable

java.lang.Object
android.graphics.drawable.Drawable
android.graphics.drawable.DrawableContainer Drawable.Callback
android.graphics.drawable.StateListDrawable

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

Summary

Public Constructors

          StateListDrawable()

Public Methods

        void  addState(int[] stateSet, Drawable drawable)
Add a new image/string ID to the set of images.
        void  inflate(Resources r, XmlPullParser parser, AttributeSet attrs)
        boolean  isStateful()
Indicates whether this view will change its appearance based on state.

Protected Methods

        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
Methods inherited from class android.graphics.drawable.Drawable
Methods inherited from class java.lang.Object
Methods inherited from interface android.graphics.drawable.Drawable.Callback

Details

Public Constructors

public StateListDrawable()

Public Methods

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.

public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs)

Throws

XmlPullParserException
IOException

public boolean isStateful()

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.

Protected Methods

protected boolean onStateChange(int[] stateSet)

Override this in your subclass to change appearance if you recognize the specified state.
Build m5-rc15g - 14 May 2008 12:50