1. TweenAnimation
补间动画
原理:通过改变图形的属性(大小、位置、透明度、角度)实现动画
步骤:
1. 新建Android XML文件,资源类型TweenAnimation
2. 编辑动画属性:
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="3000">
</alpha>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="0"
android:pivotY="50%"
android:duration="3000"
>
</rotate>
<scale
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="0.0"
android:toXScale="1.0"
android:fromYScale="0.0"
android:toYScale="1.0"
android:pivotX="80%"
android:pivotY="50%"
android:fillAfter="true"
android:duration="3000"
>
<translate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="10"
android:toXDelta="100"
android:toYDelta="100"
android:duration="3000"
>
</translate>
3. 播放动画
mImageView.startAnimation(
AnimationUtils.loadAnimation(
this, R.anim.test_alpha)); // R.anim.test_alpha可以替换为第二步的其他三个