android.graphics.drawable.TransitionDrawable
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
draw,
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
|
|
|
|
|
void |
draw(Canvas canvas) |
|
|
|
|
|
Drawable |
findDrawableByLayerId(int id) |
|
|
|
|
|
int |
getChangingConfigurations() |
|
|
|
|
|
Drawable.ConstantState |
getConstantState() |
|
|
|
|
|
Drawable |
getDrawable(int index) |
|
|
|
|
|
int |
getId(int index) |
|
|
|
|
|
int |
getIntrinsicHeight() |
|
|
|
|
|
int |
getIntrinsicWidth() |
|
|
|
|
|
int |
getNumberOfLayers() |
|
|
|
|
|
int |
getOpacity() |
|
|
|
|
|
boolean |
getPadding(Rect padding) |
|
|
|
|
|
void |
inflate(Resources r, XmlPullParser parser, AttributeSet attrs) |
|
|
|
|
|
void |
invalidateDrawable(Drawable who) |
|
|
|
|
|
boolean |
isStateful() |
|
|
|
|
|
void |
onBoundsChange(Rect bounds) |
|
|
|
|
|
boolean |
onLevelChange(int level) |
|
|
|
|
|
boolean |
onStateChange(int[] state) |
|
|
|
|
|
void |
scheduleDrawable(Drawable who, Runnable what, long when) |
|
|
|
|
|
void |
setAlpha(int alpha) |
|
|
|
|
|
void |
setColorFilter(ColorFilter cf) |
|
|
|
|
|
void |
setDither(boolean dither) |
|
|
|
|
|
boolean |
setDrawableByLayerId(int id, Drawable drawable) |
|
|
|
|
|
void |
setId(int index, int id) |
|
|
|
|
|
void |
setLayerInset(int index, int l, int t, int r, int b) |
|
|
|
|
|
boolean |
setVisible(boolean visible, boolean restart) |
|
|
|
|
|
void |
unscheduleDrawable(Drawable who, Runnable what) |
clearColorFilter,
copyBounds,
copyBounds,
createFromPath,
createFromStream,
createFromXml,
createFromXmlInner,
draw,
getBounds,
getChangingConfigurations,
getConstantState,
getCurrent,
getIntrinsicHeight,
getIntrinsicWidth,
getLevel,
getMinimumHeight,
getMinimumWidth,
getOpacity,
getPadding,
getState,
getTransparentRegion,
inflate,
invalidateSelf,
isStateful,
isVisible,
onBoundsChange,
onLevelChange,
onStateChange,
resolveOpacity,
scheduleSelf,
setAlpha,
setBounds,
setBounds,
setCallback,
setChangingConfigurations,
setColorFilter,
setColorFilter,
setDither,
setFilterBitmap,
setLevel,
setState,
setVisible,
unscheduleSelf
|
|
|
|
|
void |
clearColorFilter() |
|
|
final |
|
|
Rect |
copyBounds() |
|
|
final |
|
|
void |
copyBounds(Rect bounds) |
|
|
|
static |
|
Drawable |
createFromPath(String pathName) |
|
|
|
static |
|
Drawable |
createFromStream(InputStream is, String srcName) |
|
|
|
static |
|
Drawable |
createFromXml(Resources r, XmlPullParser parser) |
|
|
|
static |
|
Drawable |
createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs) |
abstract |
|
|
|
|
void |
draw(Canvas canvas) |
|
|
final |
|
|
Rect |
getBounds() |
|
|
|
|
|
int |
getChangingConfigurations() |
|
|
|
|
|
Drawable.ConstantState |
getConstantState() |
|
|
|
|
|
Drawable |
getCurrent() |
|
|
|
|
|
int |
getIntrinsicHeight() |
|
|
|
|
|
int |
getIntrinsicWidth() |
|
|
final |
|
|
int |
getLevel() |
|
|
|
|
|
int |
getMinimumHeight() |
|
|
|
|
|
int |
getMinimumWidth() |
abstract |
|
|
|
|
int |
getOpacity() |
|
|
|
|
|
boolean |
getPadding(Rect padding) |
|
|
|
|
|
int[] |
getState() |
|
|
|
|
|
Region |
getTransparentRegion() |
|
|
|
|
|
void |
inflate(Resources r, XmlPullParser parser, AttributeSet attrs) |
|
|
|
|
|
void |
invalidateSelf() |
|
|
|
|
|
boolean |
isStateful() |
|
|
final |
|
|
boolean |
isVisible() |
|
|
|
|
|
void |
onBoundsChange(Rect bounds) |
|
|
|
|
|
boolean |
onLevelChange(int level) |
|
|
|
|
|
boolean |
onStateChange(int[] state) |
|
|
|
static |
|
int |
resolveOpacity(int op1, int op2) |
|
|
|
|
|
void |
scheduleSelf(Runnable what, long when) |
abstract |
|
|
|
|
void |
setAlpha(int alpha) |
|
|
|
|
|
void |
setBounds(Rect bounds) |
|
|
|
|
|
void |
setBounds(int left, int top, int right, int bottom) |
|
|
final |
|
|
void |
setCallback(Drawable.Callback cb) |
|
|
|
|
|
void |
setChangingConfigurations(int configs) |
abstract |
|
|
|
|
void |
setColorFilter(ColorFilter cf) |
|
|
|
|
|
void |
setColorFilter(int color, PorterDuff.Mode mode) |
|
|
|
|
|
void |
setDither(boolean dither) |
|
|
|
|
|
void |
setFilterBitmap(boolean filter) |
|
|
final |
|
|
boolean |
setLevel(int level) |
|
|
|
|
|
boolean |
setState(int[] stateSet) |
|
|
|
|
|
boolean |
setVisible(boolean visible, boolean restart) |
|
|
|
|
|
void |
unscheduleSelf(Runnable what) |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
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
|