你好,我看到这段代码为列表视图制作比例动画
public class ViewAnimation extends Animation {
float centerX, centerY;
public ViewAnimation3(){}
@Override
public void initialize(int width, int height, int parentWidth, int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
centerX = width/2.0f;
centerY = height/2.0f;
setDuration(2500);
setFillAfter(true);
setInterpolator(new LinearInterpolator());
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
final Matrix matrix = t.getMatrix();
matrix.setScale(interpolatedTime, interpolatedTime);
matrix.preTranslate(-centerX, -centerY);
matrix.postTranslate(centerX, centerY);
}
}
我知道这将使 Activity 中心的动画而不是左上角的动画,但我不明白这些点在哪里(-centerX,-centerY)并且尊重动画左上角的内容或查看!