[关闭]
@linux1s1s 2017-01-22T08:26:14.000000Z 字数 1142 阅读 2535

Android 动画初步

AndroidAnimation 2016-06


Android 中动画一般有三种

这里仅仅介绍前两种,比较复杂的属性动画将在另外一篇博客中单独介绍

Tween Animation

通过对场景里的对象不断做图像变换(平移、缩放、旋转)产生动画效果,即是一种渐变动画。
渐变动画的四个属性

然后直接看一下Demo做个直观的了解

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <set xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:fillAfter = "false"
  4. android:zAdjustment="bottom"
  5. >
  6. <rotate
  7. android:fromDegrees="0"
  8. android:toDegrees="360"
  9. android:pivotX="50%"
  10. android:pivotY="50%"
  11. android:duration="4000"
  12. />
  13. </set>
  1. Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.rotate);
  2. anim.setAnimationListener(new EffectAnimationListener());
  3. textWidget = (TextView)findViewById(R.id.text_widget);
  4. textWidget.setText("Rotate Now");
  5. textWidget.startAnimation(anim);

Frame Animation

Frame Animation是顺序播放事先做好的图像,跟电影类似。
Android SDK提供了AnimationDrawable类来定义使用Frame Animation。

参考:
http://developer.android.com/training/animation/crossfade.html
关于属性动画这里可以参考文章:
http://blog.csdn.net/lmj623565791/article/details/38067475
http://www.cnblogs.com/kissazi2/p/4249213.html

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注