XML动画
android:duration //持续时间
android:fromAlpha //从xxx开始
android:toAlpha //到xxx结束
android:pivotX //位置
<!--透明动画-->
<alpha
android:duration="5000"
android:fromAlpha="0.1"
android:toAlpha="1.0"
/>
<!--旋转动画-->
<rotate
android:duration="5000"
android:fromDegrees="0"
android:toDegrees="+3600"
android:pivotX="50%"
android:pivotY="50%"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
/>
<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>android:fromDegrees 起始度数
>android:toDegrees 终止度数
>android:pivotX 位置 50%为中心点
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->
<!--缩放动画-->
<scale
android:duration="5000"
android:fillAfter="false"
android:fromXScale="0.0"
android:fromYScale="0.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0"
/>
<!-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>android:duration 动画持续时间
>android:fillAfter 是否保留缩放的图片大小
>android:fromXScale 从多大开始
>android:toXScale 到多大结束
>android:interpolator 动画插入器
>android:pivotX 从图片的哪个点开始缩放,50%指的是中间
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->
<!--位移动画-->
<translate
android:duration="5000"
android:fromXDelta="0"
android:fromYDelta="10"
android:toXDelta="0"
android:toYDelta="500"
/>
设置动画
Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.all);
imageView.startAnimation(animation);
Java动画
AlphaAnimation alphaAnimation=new AlphaAnimation(0.0f,1.0f);
alphaAnimation.setDuration(5000);
alphaAnimation.setRepeatCount(10);
alphaAnimation.setRepeatMode(Animation.REVERSE);
imageView.startAnimation(alphaAnimation);
Activity跳转动画
Intent intent = new Intent(MainActivity.this, ListActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.zoom_in, R.anim.zoom_out);
ListView动画
LayoutAnimationController controller = new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_in));
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);//设置显示方式 ORDER_NORMAL为普通顺序显示
listView.setLayoutAnimation(controller);
listView.startLayoutAnimation();