Build 1.0_r1(from source)

android.graphics.drawable
Class TransitionDrawable

java.lang.Object
  extended by android.graphics.drawable.Drawable
      extended by android.graphics.drawable.LayerDrawable
          extended by android.graphics.drawable.TransitionDrawable
All Implemented Interfaces:
Drawable.Callback

public class TransitionDrawable
extends LayerDrawable
implements Drawable.Callback

Transition drawables are an extension of LayerDrawables and are intended to cross fade between the first and second layers. To start the transition, call startTransition(int). To display just the first layer, call resetTransition()


Nested Class Summary
(package private) static class TransitionDrawable.TransitionState
           
 
Nested classes/interfaces inherited from class android.graphics.drawable.LayerDrawable
LayerDrawable.LayerState, LayerDrawable.Rec
 
Nested classes/interfaces inherited from class android.graphics.drawable.Drawable
Drawable.Callback, Drawable.ConstantState
 
Field Summary
 
Fields inherited from class android.graphics.drawable.LayerDrawable
mLayerState
 
Fields inherited from class android.graphics.drawable.Drawable
mCallback
 
Constructor Summary
TransitionDrawable()
           
 
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).
 boolean isCrossFadeEnabled()
          Indicates whether the cross fade is enabled for this transition.
 void resetTransition()
          Show only the first layer.
 void reverseTransition(int duration)
          Reverses the transition, picking up where the transition currently is.
 void setCrossFadeEnabled(boolean enabled)
          Enables or disables the cross fade of the drawables.
 void startTransition(int durationMillis)
          Begin the second layer on top of the first layer.
 
Methods inherited from class android.graphics.drawable.LayerDrawable
findDrawableByLayerId, getChangingConfigurations, getConstantState, getDrawable, getId, getIntrinsicHeight, getIntrinsicWidth, getNumberOfLayers, getOpacity, getPadding, inflate, invalidateDrawable, isStateful, onBoundsChange, onLevelChange, onStateChange, scheduleDrawable, setAlpha, setColorFilter, setDither, setDrawableByLayerId, setId, setLayerInset, setVisible, unscheduleDrawable
 
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
 
Methods inherited from interface android.graphics.drawable.Drawable.Callback
invalidateDrawable, scheduleDrawable, unscheduleDrawable
 

Constructor Detail

TransitionDrawable

TransitionDrawable()
Method Detail

createConstantState

LayerDrawable.LayerState createConstantState(LayerDrawable.LayerState state)
Overrides:
createConstantState in class LayerDrawable

startTransition

public void startTransition(int durationMillis)
Begin the second layer on top of the first layer.

Parameters:
durationMillis - The length of the transition in milliseconds

resetTransition

public void resetTransition()
Show only the first layer.


reverseTransition

public void reverseTransition(int duration)
Reverses the transition, picking up where the transition currently is. If the transition is not currently running, this will start the transition with the specified duration. If the transition is already running, the last known duration will be used.

Parameters:
duration - The duration to use if no transition is running.

draw

public void draw(Canvas canvas)
Description copied from class: Drawable
Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha) and color filter (set via setColorFilter).

Overrides:
draw in class LayerDrawable
Parameters:
canvas - The canvas to draw into

setCrossFadeEnabled

public void setCrossFadeEnabled(boolean enabled)
Enables or disables the cross fade of the drawables. When cross fade is disabled, the first drawable is always drawn opaque. With cross fade enabled, the first drawable is drawn with the opposite alpha of the second drawable.

Parameters:
enabled - True to enable cross fading, false otherwise.

isCrossFadeEnabled

public boolean isCrossFadeEnabled()
Indicates whether the cross fade is enabled for this transition.

Returns:
True if cross fading is enabled, false otherwise.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature