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 帧动画

  • 相关阅读:
    php中运算符的分类及注意事项
    ecshopv3.6安装
    phpstudy多站点配置教程
    织梦dedecms出现DedeCMS Error: (PHP 5.3 and above) Please set 'request_order' ini value to i解决办法
    thinkphp3.2批量删除功能
    怎么使用阿里图标库
    人人网,微博,QQ空间,朋友圈,常用API调用实现方法
    ueditor注意事项
    大图在小于自身的div中,水平居中
    thinkphp3.2 实现分页功能
  • 原文地址:https://www.cnblogs.com/zzl521/p/8870035.html
Copyright © 2011-2022 走看看