zoukankan      html  css  js  c++  java
  • Android动画

    动画分为三种:补间动画,属性动画,帧动画

    先介绍前两种

      特点
    补间动画 不会改变控件的真实坐标
    属性动画 会改变控件的真实坐标
     帧动画  最原始的动画(靠频率快实现)

    1 补间动画(Alpha,Rotate,Scale,Translate)

         AlphaAnimation alphaAnimation=new AlphaAnimation(0,1);
            alphaAnimation.setDuration(3000);
            rl.startAnimation(alphaAnimation);

    上面是一段简单的补间动画(透明属性的应用)

    也可以用xml来定义的动画

    2 属性动画

      下面即是一段简单的属性动画

         ObjectAnimator oa1=ObjectAnimator.ofFloat(ll_now,"translationY",ll_now.getY(),ll_now.getY()-scrollHeight);
            ObjectAnimator oa2=ObjectAnimator.ofFloat(ll_now,"translationY",ll_now.getY(),ll_now.getY()-scrollHeight);
            AnimatorSet animatorSet=new AnimatorSet();
            animatorSet.playTogether(oa1,oa1);
            animatorSet.setDuration(duration);
            animatorSet.start();

    ObjectAnimator是由自己的静态方法生成的,然后就是多个属性动画要用AnimatorSet 这点要注意和Animation的补间动画分开。

    属性动画的异常常见

     Circular dependencies cannot exist in AnimatorSet   //这个是由于在AnimatorSet 中一次性加入了重复的属性动画对象导致的

    采坑问题

    在Android 3.0中出现   error @android:windowEnterAnimation not found

      解决方法有2个

    第一个:在Project/gradle.properties中添加 android.enableAapt2=false

    第二个:去掉android前面的@就可以了

    这个博客挺好的https://www.jianshu.com/p/420629118c10

     

    3 帧动画

  • 相关阅读:
    安装minicom串口访问开发板
    《Linux运维趋势》2010-2013年全部期刊下载
    pap与chap协议
    简单linux网络驱动程序
    573. Squirrel Simulation
    576. Out of Boundary Paths
    568. Maximum Vacation Days
    leetcode contest 20
    55 Jump Game i && 45 Jump Game ii
    120. Triangle
  • 原文地址:https://www.cnblogs.com/zzl521/p/8870035.html
Copyright © 2011-2022 走看看