|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nineoldandroids.view.ViewPropertyAnimator
public abstract class ViewPropertyAnimator
This class enables automatic and optimized animation of select properties on View objects.
If only one or two properties on a View object are being animated, then using an
ObjectAnimator
is fine; the property setters called by ObjectAnimator
are well equipped to do the right thing to set the property and invalidate the view
appropriately. But if several properties are animated simultaneously, or if you just want a
more convenient syntax to animate a specific property, then ViewPropertyAnimator might be
more well-suited to the task.
This class may provide better performance for several simultaneous animations, because it will optimize invalidate calls to take place only once for several properties instead of each animated property independently causing its own invalidation. Also, the syntax of using this class could be easier to use because the caller need only tell the View object which property to animate, and the value to animate either to or by, and this class handles the details of configuring the underlying Animator class and starting it.
This class is not constructed by the caller, but rather by the View whose properties
it will animate. Calls to View
will return a reference
to the appropriate ViewPropertyAnimator object for that View.
Constructor Summary | |
---|---|
ViewPropertyAnimator()
|
Method Summary | |
---|---|
abstract ViewPropertyAnimator |
alpha(float value)
This method will cause the View's alpha property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
alphaBy(float value)
This method will cause the View's alpha property to be animated by the
specified value. |
static ViewPropertyAnimator |
animate(View view)
This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View. |
abstract void |
cancel()
Cancels all property animations that are currently running or pending. |
abstract long |
getDuration()
Returns the current duration of property animations. |
abstract long |
getStartDelay()
Returns the current startDelay of property animations. |
abstract ViewPropertyAnimator |
rotation(float value)
This method will cause the View's rotation property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
rotationBy(float value)
This method will cause the View's rotation property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
rotationX(float value)
This method will cause the View's rotationX property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
rotationXBy(float value)
This method will cause the View's rotationX property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
rotationY(float value)
This method will cause the View's rotationY property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
rotationYBy(float value)
This method will cause the View's rotationY property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
scaleX(float value)
This method will cause the View's scaleX property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
scaleXBy(float value)
This method will cause the View's scaleX property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
scaleY(float value)
This method will cause the View's scaleY property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
scaleYBy(float value)
This method will cause the View's scaleY property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
setDuration(long duration)
Sets the duration for the underlying animator that animates the requested properties. |
abstract ViewPropertyAnimator |
setInterpolator(Interpolator interpolator)
Sets the interpolator for the underlying animator that animates the requested properties. |
abstract ViewPropertyAnimator |
setListener(Animator.AnimatorListener listener)
Sets a listener for events in the underlying Animators that run the property animations. |
abstract ViewPropertyAnimator |
setStartDelay(long startDelay)
Sets the startDelay for the underlying animator that animates the requested properties. |
abstract void |
start()
Starts the currently pending property animations immediately. |
abstract ViewPropertyAnimator |
translationX(float value)
This method will cause the View's translationX property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
translationXBy(float value)
This method will cause the View's translationX property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
translationY(float value)
This method will cause the View's translationY property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
translationYBy(float value)
This method will cause the View's translationY property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
x(float value)
This method will cause the View's x property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
xBy(float value)
This method will cause the View's x property to be animated by the
specified value. |
abstract ViewPropertyAnimator |
y(float value)
This method will cause the View's y property to be animated to the
specified value. |
abstract ViewPropertyAnimator |
yBy(float value)
This method will cause the View's y property to be animated by the
specified value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ViewPropertyAnimator()
Method Detail |
---|
public static ViewPropertyAnimator animate(View view)
view
- View to animate.
public abstract ViewPropertyAnimator setDuration(long duration)
duration
- The length of ensuing property animations, in milliseconds. The value
cannot be negative.
public abstract long getDuration()
setDuration(long)
public abstract long getStartDelay()
setStartDelay(long)
public abstract ViewPropertyAnimator setStartDelay(long startDelay)
startDelay
- The delay of ensuing property animations, in milliseconds. The value
cannot be negative.
public abstract ViewPropertyAnimator setInterpolator(Interpolator interpolator)
interpolator
- The TimeInterpolator to be used for ensuing property animations.
public abstract ViewPropertyAnimator setListener(Animator.AnimatorListener listener)
listener
- The listener to be called with AnimatorListener events.
public abstract void start()
start()
is optional because all animations start automatically at the next opportunity. However,
if the animations are needed to start immediately and synchronously (not at the time when
the next event is processed by the hierarchy, which is when the animations would begin
otherwise), then this method can be used.
public abstract void cancel()
public abstract ViewPropertyAnimator x(float value)
x
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setX(float)
public abstract ViewPropertyAnimator xBy(float value)
x
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setX(float)
public abstract ViewPropertyAnimator y(float value)
y
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setY(float)
public abstract ViewPropertyAnimator yBy(float value)
y
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setY(float)
public abstract ViewPropertyAnimator rotation(float value)
rotation
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setRotation(float)
public abstract ViewPropertyAnimator rotationBy(float value)
rotation
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setRotation(float)
public abstract ViewPropertyAnimator rotationX(float value)
rotationX
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setRotationX(float)
public abstract ViewPropertyAnimator rotationXBy(float value)
rotationX
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setRotationX(float)
public abstract ViewPropertyAnimator rotationY(float value)
rotationY
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setRotationY(float)
public abstract ViewPropertyAnimator rotationYBy(float value)
rotationY
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setRotationY(float)
public abstract ViewPropertyAnimator translationX(float value)
translationX
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setTranslationX(float)
public abstract ViewPropertyAnimator translationXBy(float value)
translationX
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setTranslationX(float)
public abstract ViewPropertyAnimator translationY(float value)
translationY
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setTranslationY(float)
public abstract ViewPropertyAnimator translationYBy(float value)
translationY
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setTranslationY(float)
public abstract ViewPropertyAnimator scaleX(float value)
scaleX
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setScaleX(float)
public abstract ViewPropertyAnimator scaleXBy(float value)
scaleX
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setScaleX(float)
public abstract ViewPropertyAnimator scaleY(float value)
scaleY
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setScaleY(float)
public abstract ViewPropertyAnimator scaleYBy(float value)
scaleY
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setScaleY(float)
public abstract ViewPropertyAnimator alpha(float value)
alpha
property to be animated to the
specified value. Animations already running on the property will be canceled.
value
- The value to be animated to.
View#setAlpha(float)
public abstract ViewPropertyAnimator alphaBy(float value)
alpha
property to be animated by the
specified value. Animations already running on the property will be canceled.
value
- The amount to be animated by, as an offset from the current value.
View#setAlpha(float)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |