加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20111008051822/http://developer.android.com/reference/android/view/ViewPropertyAnimator.html
public class

ViewPropertyAnimator

extends Object
java.lang.Object
   ↳ android.view.ViewPropertyAnimator

Class Overview

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 animate() will return a reference to the appropriate ViewPropertyAnimator object for that View.

Summary

Public Methods
ViewPropertyAnimator alpha(float value)
This method will cause the View's alpha property to be animated to the specified value.
ViewPropertyAnimator alphaBy(float value)
This method will cause the View's alpha property to be animated by the specified value.
ViewPropertyAnimator rotation(float value)
This method will cause the View's rotation property to be animated to the specified value.
ViewPropertyAnimator rotationBy(float value)
This method will cause the View's rotation property to be animated by the specified value.
ViewPropertyAnimator rotationX(float value)
This method will cause the View's rotationX property to be animated to the specified value.
ViewPropertyAnimator rotationXBy(float value)
This method will cause the View's rotationX property to be animated by the specified value.
ViewPropertyAnimator rotationY(float value)
This method will cause the View's rotationY property to be animated to the specified value.
ViewPropertyAnimator rotationYBy(float value)
This method will cause the View's rotationY property to be animated by the specified value.
ViewPropertyAnimator scaleX(float value)
This method will cause the View's scaleX property to be animated to the specified value.
ViewPropertyAnimator scaleXBy(float value)
This method will cause the View's scaleX property to be animated by the specified value.
ViewPropertyAnimator scaleY(float value)
This method will cause the View's scaleY property to be animated to the specified value.
ViewPropertyAnimator scaleYBy(float value)
This method will cause the View's scaleY property to be animated by the specified value.
ViewPropertyAnimator setDuration(long duration)
Sets the duration for the underlying animator that animates the requested properties.
ViewPropertyAnimator setInterpolator(TimeInterpolator interpolator)
Sets the interpolator for the underlying animator that animates the requested properties.
ViewPropertyAnimator setListener(Animator.AnimatorListener listener)
Sets a listener for events in the underlying Animators that run the property animations.
ViewPropertyAnimator translationX(float value)
This method will cause the View's translationX property to be animated to the specified value.
ViewPropertyAnimator translationXBy(float value)
This method will cause the View's translationX property to be animated by the specified value.
ViewPropertyAnimator translationY(float value)
This method will cause the View's translationY property to be animated to the specified value.
ViewPropertyAnimator translationYBy(float value)
This method will cause the View's translationY property to be animated by the specified value.
ViewPropertyAnimator x(float value)
This method will cause the View's x property to be animated to the specified value.
ViewPropertyAnimator xBy(float value)
This method will cause the View's x property to be animated by the specified value.
ViewPropertyAnimator y(float value)
This method will cause the View's y property to be animated to the specified value.
ViewPropertyAnimator yBy(float value)
This method will cause the View's y property to be animated by the specified value.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public ViewPropertyAnimator alpha (float value)

Since: API Level 12

This method will cause the View's alpha property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator alphaBy (float value)

Since: API Level 12

This method will cause the View's alpha property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator rotation (float value)

Since: API Level 12

This method will cause the View's rotation property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator rotationBy (float value)

Since: API Level 12

This method will cause the View's rotation property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator rotationX (float value)

Since: API Level 12

This method will cause the View's rotationX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator rotationXBy (float value)

Since: API Level 12

This method will cause the View's rotationX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator rotationY (float value)

Since: API Level 12

This method will cause the View's rotationY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator rotationYBy (float value)

Since: API Level 12

This method will cause the View's rotationY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator scaleX (float value)

Since: API Level 12

This method will cause the View's scaleX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator scaleXBy (float value)

Since: API Level 12

This method will cause the View's scaleX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator scaleY (float value)

Since: API Level 12

This method will cause the View's scaleY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator scaleYBy (float value)

Since: API Level 12

This method will cause the View's scaleY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator setDuration (long duration)

Since: API Level 12

Sets the duration for the underlying animator that animates the requested properties. By default, the animator uses the default value for ValueAnimator. Calling this method will cause the declared value to be used instead.

Parameters
duration The length of ensuing property animations, in milliseconds. The value cannot be negative.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator setInterpolator (TimeInterpolator interpolator)

Since: API Level 12

Sets the interpolator for the underlying animator that animates the requested properties. By default, the animator uses the default interpolator for ValueAnimator. Calling this method will cause the declared object to be used instead.

Parameters
interpolator The TimeInterpolator to be used for ensuing property animations.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator setListener (Animator.AnimatorListener listener)

Since: API Level 12

Sets a listener for events in the underlying Animators that run the property animations.

Parameters
listener The listener to be called with AnimatorListener events.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator translationX (float value)

Since: API Level 12

This method will cause the View's translationX property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator translationXBy (float value)

Since: API Level 12

This method will cause the View's translationX property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator translationY (float value)

Since: API Level 12

This method will cause the View's translationY property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator translationYBy (float value)

Since: API Level 12

This method will cause the View's translationY property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.

public ViewPropertyAnimator x (float value)

Since: API Level 12

This method will cause the View's x property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator xBy (float value)

Since: API Level 12

This method will cause the View's x property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator y (float value)

Since: API Level 12

This method will cause the View's y property to be animated to the specified value. Animations already running on the property will be canceled.

Parameters
value The value to be animated to.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also

public ViewPropertyAnimator yBy (float value)

Since: API Level 12

This method will cause the View's y property to be animated by the specified value. Animations already running on the property will be canceled.

Parameters
value The amount to be animated by, as an offset from the current value.
Returns
  • This object, allowing calls to methods in this class to be chained.
See Also