原理:由两个动画组合实现;监听第一个动画结束,开始第二个动画,具体代码如下

/** * 翻牌动画 */public void cardTurnover() {    scan_barcode_iv.setImageResource(R.drawable.but_tex);    if (back_scale_animation == null) {        back_scale_animation = AnimationUtils.loadAnimation(getContext(), R.anim.back_scale);    }    back_scale_animation.setAnimationListener(new Animation.AnimationListener() {        @Override        public void onAnimationStart(Animation animation) {        }        @Override        public void onAnimationEnd(Animation animation) {            scan_barcode_iv.setImageResource(R.drawable.but_icon);            if (front_scale_animation == null) {                front_scale_animation = AnimationUtils.loadAnimation(getContext(), R.anim.front_scale);            }            LinearInterpolator lir = new LinearInterpolator();            front_scale_animation.setInterpolator(lir);            scan_barcode_iv.startAnimation(front_scale_animation);        }        @Override        public void onAnimationRepeat(Animation animation) {        }    });    LinearInterpolator lir = new LinearInterpolator();    back_scale_animation.setInterpolator(lir);    scan_barcode_iv.startAnimation(back_scale_animation);}动画一:back_scale.xml
<?xml version="1.0" encoding="utf-8"?>xmlns:android="http://schemas.android.com/apk/res/android">            android:fromXScale="1.0"        android:toXScale="0.0"        android:fromYScale="1.0"        android:toYScale="1.0"        android:pivotX="50%"        android:pivotY="50%"        android:duration="200"/>

动画二:front_scale.xml
<?xml version="1.0" encoding="utf-8"?>xmlns:android="http://schemas.android.com/apk/res/android">            android:fromXScale="0.0"        android:toXScale="1.0"        android:fromYScale="1.0"        android:toYScale="1.0"        android:pivotX="50%"        android:pivotY="50%"        android:duration="200"/>



更多相关文章

  1. android腾讯微博吹一吹实现原理
  2. Android应用程序组件Content Provider在应用程序之间共享数据的
  3. Android弹性动画三种实现方式
  4. Android View 的工作原理浅析
  5. android中四个典型动画设置
  6. Android应用程序组件Content Provider在应用程序之间共享数据的
  7. Android Debug Bridge 技术实现原理
  8. Android Property Animation属性动画初识:透明渐变(1)
  9. android移动补间动画

随机推荐

  1. Android(安卓)中的微型云
  2. Android使用第三方SDK——百度地图
  3. android 面试题三
  4. Android(安卓)7.1.1系统源码下载、编译、
  5. windows 下adb不能找到Android设备
  6. Android性能优化-SQLite数据库
  7. Android地图应用新视界--mapbox的常用功
  8. Android和js、H5进行交互数据(面试必问)
  9. android makefile(android.mk)分析(序)
  10. Android读写XML(中)——SAX