【发布时间】:2018-02-18 00:09:22
【问题描述】:
我在适配器的点击事件中为ProgressBar 设置了一个动画
ObjectAnimator animation = ObjectAnimator.ofInt(holder.progressbar, "progress", 0, 100);
animation.setDuration(PROGRESS_TIME);
animation.setInterpolator(new DecelerateInterpolator());
animation.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
Toast.makeText(context,"HELL_Start",Toast.LENGTH_SHORT).show();
}
@Override
public void onAnimationEnd(Animator animator) {
//do something when the countdown is complete
Toast.makeText(context,"HELL_OFF_END",Toast.LENGTH_SHORT).show();
}
@Override
public void onAnimationCancel(Animator animator) {
Toast.makeText(context,"HELL_OFF_Cancel",Toast.LENGTH_SHORT).show();
}
@Override
public void onAnimationRepeat(Animator animator) { }
});
animation.start();
我正在尝试使用
从ProgressBar 获取动画(当列表项值更改时)
AlphaAnimation animation = (AlphaAnimation)mProgressBar.getAnimation();
但它正在返回null
【问题讨论】:
-
您的对象动画师独立于视图工作,因此您无法从视图中获取它。但是你为什么不直接引用你创建的动画呢?
-
@dominicoder 如何为每个列表项添加它,然后在单击时引用它
标签: android android-animation android-progressbar