public class TranslateAnimation
extends Animation
java.lang.Object | ||
↳ | android.view.animation.Animation | |
↳ | android.view.animation.TranslateAnimation |
控制对象位置的动画。 有关详细信息和示例代码,请参阅full package
说明。
Inherited XML attributes |
|
---|---|
From class android.view.animation.Animation
|
Inherited constants |
---|
From class android.view.animation.Animation
|
Public constructors |
|
---|---|
TranslateAnimation(Context context, AttributeSet attrs) 从资源加载TranslateAnimation时使用的构造函数。 |
|
TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta) 从代码构建TranslateAnimation时使用的构造函数 |
|
TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue) 从代码构建TranslateAnimation时使用的构造函数 |
Public methods |
|
---|---|
void |
initialize(int width, int height, int parentWidth, int parentHeight) 使用被动画对象的维度以及对象父项来初始化此动画。 |
Protected methods |
|
---|---|
void |
applyTransformation(float interpolatedTime, Transformation t) 帮助getTransformation。 |
Inherited methods |
|
---|---|
From class android.view.animation.Animation
|
|
From class java.lang.Object
|
TranslateAnimation (Context context, AttributeSet attrs)
从资源加载TranslateAnimation时使用的构造函数。
Parameters | |
---|---|
context |
Context : Application context to use |
attrs |
AttributeSet : Attribute set from which to read values |
TranslateAnimation (float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)
从代码构建TranslateAnimation时使用的构造函数
Parameters | |
---|---|
fromXDelta |
float : Change in X coordinate to apply at the start of the animation |
toXDelta |
float : Change in X coordinate to apply at the end of the animation |
fromYDelta |
float : Change in Y coordinate to apply at the start of the animation |
toYDelta |
float : Change in Y coordinate to apply at the end of the animation |
TranslateAnimation (int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue)
从代码构建TranslateAnimation时使用的构造函数
Parameters | |
---|---|
fromXType |
int : Specifies how fromXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT. |
fromXValue |
float : Change in X coordinate to apply at the start of the animation. This value can either be an absolute number if fromXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
toXType |
int : Specifies how toXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT. |
toXValue |
float : Change in X coordinate to apply at the end of the animation. This value can either be an absolute number if toXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
fromYType |
int : Specifies how fromYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT. |
fromYValue |
float : Change in Y coordinate to apply at the start of the animation. This value can either be an absolute number if fromYType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
toYType |
int : Specifies how toYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT. |
toYValue |
float : Change in Y coordinate to apply at the end of the animation. This value can either be an absolute number if toYType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
void initialize (int width, int height, int parentWidth, int parentHeight)
使用被动画对象的维度以及对象父项来初始化此动画。 (这是为了支持相对于这些尺寸指定的动画尺寸。)
解析动画的对象在调用 getTransformation(long, Transformation)
之前,应该调用此方法,以便知道动画对象的大小及其父对象的大小。
Parameters | |
---|---|
width |
int : Width of the object being animated |
height |
int : Height of the object being animated |
parentWidth |
int : Width of the animated object's parent |
parentHeight |
int : Height of the animated object's parent |
void applyTransformation (float interpolatedTime, Transformation t)
帮助getTransformation。 子类应该实现这个以应用赋予插值的变换。 此方法的实现应始终替换指定的转换或其他文档。
Parameters | |
---|---|
interpolatedTime |
float : The value of the normalized time (0.0 to 1.0) after it has been run through the interpolation function. |
t |
Transformation : The Transformation object to fill in with the current transforms. |