java.lang.Object | |
↳ | android.view.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 animate()
will return a reference
to the appropriate ViewPropertyAnimator object for that View.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method will cause the View's
alpha property to be animated to the
specified value. | |||||||||||
This method will cause the View's
alpha property to be animated by the
specified value. | |||||||||||
Cancels all property animations that are currently running or pending.
| |||||||||||
Returns the current duration of property animations.
| |||||||||||
Returns the current startDelay of property animations.
| |||||||||||
This method will cause the View's
rotation property to be animated to the
specified value. | |||||||||||
This method will cause the View's
rotation property to be animated by the
specified value. | |||||||||||
This method will cause the View's
rotationX property to be animated to the
specified value. | |||||||||||
This method will cause the View's
rotationX property to be animated by the
specified value. | |||||||||||
This method will cause the View's
rotationY property to be animated to the
specified value. | |||||||||||
This method will cause the View's
rotationY property to be animated by the
specified value. | |||||||||||
This method will cause the View's
scaleX property to be animated to the
specified value. | |||||||||||
This method will cause the View's
scaleX property to be animated by the
specified value. | |||||||||||
This method will cause the View's
scaleY property to be animated to the
specified value. | |||||||||||
This method will cause the View's
scaleY property to be animated by the
specified value. | |||||||||||
Sets the duration for the underlying animator that animates the requested properties.
| |||||||||||
Sets the interpolator for the underlying animator that animates the requested properties.
| |||||||||||
Sets a listener for events in the underlying Animators that run the property
animations.
| |||||||||||
Sets the startDelay for the underlying animator that animates the requested properties.
| |||||||||||
Starts the currently pending property animations immediately.
| |||||||||||
This method will cause the View's
translationX property to be animated to the
specified value. | |||||||||||
This method will cause the View's
translationX property to be animated by the
specified value. | |||||||||||
This method will cause the View's
translationY property to be animated to the
specified value. | |||||||||||
This method will cause the View's
translationY property to be animated by the
specified value. | |||||||||||
This method will cause the View's
x property to be animated to the
specified value. | |||||||||||
This method will cause the View's
x property to be animated by the
specified value. | |||||||||||
This method will cause the View's
y property to be animated to the
specified 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
|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
Cancels all property animations that are currently running or pending.
Returns the current duration of property animations. If the duration was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.
Returns the current startDelay of property animations. If the startDelay was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
duration | The length of ensuing property animations, in milliseconds. The value cannot be negative. |
---|
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.
interpolator | The TimeInterpolator to be used for ensuing property animations. |
---|
Sets a listener for events in the underlying Animators that run the property animations.
listener | The listener to be called with AnimatorListener events. |
---|
Sets the startDelay 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.
startDelay | The delay of ensuing property animations, in milliseconds. The value cannot be negative. |
---|
Starts the currently pending property animations immediately. Calling 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.
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|
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.
value | The value to be animated to. |
---|
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.
value | The amount to be animated by, as an offset from the current value. |
---|