Android

android.graphics.drawable.TransitionDrawable

java.lang.Object
android.graphics.drawable.Drawable
android.graphics.drawable.LayerDrawable Drawable.Callback
android.graphics.drawable.TransitionDrawable 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()

Summary

Public Methods

          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
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 Methods

public 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).

Parameters

canvas The canvas to draw into

public boolean isCrossFadeEnabled()

Indicates whether the cross fade is enabled for this transition.

Returns

  • True if cross fading is enabled, false otherwise.

public void resetTransition()

Show only the first layer.

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.

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.

public void startTransition(int durationMillis)

Begin the second layer on top of the first layer.

Parameters

durationMillis The length of the transition in milliseconds
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48