Android动画进程回调方法

Android动画进程回调方法,android,multithreading,animation,asynchronous,Android,Multithreading,Animation,Asynchronous,我想知道,像jQuery一样,有一个选项可以检查android中任何控件的动画剩余时间。希望检查完成动画还剩下多少毫秒。具体来说,就是在当前正在运行的动画的开始和结束之间运行的侦听器。我自己已经找到了答案。因为我想使用此功能来增加固定时间过程的时间或动画剩余的时间,所以我发现了这一点 import android.view.View; import android.view.animation.Animation; import android.view.animation.Transforma

我想知道,像jQuery一样,有一个选项可以检查android中任何控件的动画剩余时间。希望检查完成动画还剩下多少毫秒。具体来说,就是在当前正在运行的动画的开始和结束之间运行的侦听器。

我自己已经找到了答案。因为我想使用此功能来增加固定时间过程的时间或动画剩余的时间,所以我发现了这一点

import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Transformation;

public class HeightAnimation extends Animation {
    protected final int originalHeight;
    protected final View view;
    protected float perValue;

    public HeightAnimation(View view, int fromHeight, int toHeight) {
        this.view = view;
        this.originalHeight = fromHeight;
        this.perValue = (toHeight - fromHeight);
    }

    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        view.getLayoutParams().height = (int) (originalHeight + perValue
                * interpolatedTime);
        view.requestLayout();
    }

    @Override
    public boolean willChangeBounds() {
        return true;
    }
}  
applyTransformation给了我剩余的时间或进度回调的效果,但它解决了我的问题