The property animation system can animate Views on the screen by changing the actual properties in the View objects. In addition, Views also automatically call the invalidate()
method to refresh the screen whenever its properties are changed. The new properties in the View
class that facilitate property animations are:
-
translationX
andtranslationY
: These properties control where the View is located as a delta from its left and top coordinates which are set by its layout container. -
rotation
,rotationX
, androtationY
: These properties control the rotation in 2D (rotation
property) and 3D around the pivot point. -
scaleX
andscaleY
: These properties control the 2D scaling of a View around its pivot point. -
pivotX
andpivotY
: These properties control the location of the pivot point, around which the rotation and scaling transforms occur. By default, the pivot point is located at the center of the object. -
x
andy
: These are simple utility properties to describe the final location of the View in its container, as a sum of the left and top values and translationX and translationY values. -
alpha
: Represents the alpha transparency on the View. This value is 1 (opaque) by default, with a value of 0 representing full transparency (not visible).
To animate a property of a View object, such as its color or rotation value, all you need to do is create a property animator and specify the View property that you want to animate. For example:
ObjectAnimator.ofFloat(myView,"rotation",0f,360f);
For more information on creating animators, see the sections on animating with ValueAnimator andObjectAnimator.
链接:http://developer.android.com/intl/zh-cn/guide/topics/graphics/prop-animation.html#property-vs-view