属性动画最全讲解

属性动画最明白的讲解

 最简单的例子:

//最简单的渐入渐出效果,
// “ofFloat”标识后面的数值变化量是【Float】类型
//第一个参数随便填写,不一定非要局限在view范围内
//第二个参数也是随便写,但是要保证这个参数代表的含义是第一个参数具有的,【例如:如果是view的话,
// 所传的参数可以是在layout布局内,这个view所代表的所有标识(“background”“translationX”“scaleX”等等)】
//从第三个参数开始,参数数量也是没有限制的,可以是两个或者是三个,或者是十万个都可以!代表的含义就是渐变的过程
 ObjectAnimator animator = ObjectAnimator.ofFloat(shop_buyer_parent, "alpha", 0.0f, 1.0f, 0.0f);
 animator.setDuration(3000);
 animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
       @Override
       public void onAnimationUpdate(ValueAnimator animation) {
           float currentValue = (float) animation.getAnimatedValue();
           Log_Ma.d("TAG", "cuurent value is " + currentValue);
           }
       });
 animator.start();

猜你喜欢

转载自blog.csdn.net/fengyeNom1/article/details/103873594