xml实现

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:ordering="together" >

    <objectAnimator
        android:duration="3000"
        android:propertyName="alpha"
        android:valueFrom="0"
        android:valueTo="1" >
    </objectAnimator>
    <objectAnimator
        android:duration="4000"
        android:propertyName="scaleX"
        android:valueFrom="0.5"
        android:valueTo="1"
        android:valueType="floatType" >
    </objectAnimator>
    <objectAnimator
        android:duration="5000"
        android:propertyName="scaleY"
        android:valueFrom="0.5"
        android:valueTo="1" >
    </objectAnimator>

</set>
Animator animator = AnimatorInflater.loadAnimator(this, R.animator.set);
        animator.setTarget(imageview);
        animator.start();

下面是java代码实现

// 透明度属性动画
public void alpha(View view) {

    ObjectAnimator object_anim = ObjectAnimator.ofFloat(imageview, "alpha", 0,1.0f);
    //设置持续时间。
    object_anim.setDuration(3000);
    //启动动画。.
    object_anim.start();
}

//缩放属性动画。
public void scale(View view) {
    ObjectAnimator scale_anim = ObjectAnimator.ofFloat(imageview, "scaleX", 0.5f,2);
    scale_anim.setDuration(5000);
    scale_anim.setRepeatCount(0);
    ObjectAnimator scale_anim_y = ObjectAnimator.ofFloat(imageview, "scaleY", 0.5f,2);
    scale_anim_y.setDuration(5000);
    scale_anim_y.setRepeatCount(0);
    scale_anim_y.start();
    scale_anim.start();
}

//位移属性动画
public void translate(View view) {
    ObjectAnimator translate_anim = ObjectAnimator.ofFloat(imageview, "shadowDx", 0,200);
    translate_anim.setDuration(3000);
    translate_anim.setRepeatCount(0);
    translate_anim.start();
}

//旋转属性动画
public void rotate(View view) {
    ObjectAnimator translate_anim = ObjectAnimator.ofFloat(imageview, "translateX", 0,200);

}

*属性动画的监听方法

animator.addListener(new AnimatorListener() {

    @Override
    public void onAnimationStart(Animator animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationRepeat(Animator animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationEnd(Animator animation) {
        //跳转。
        Intent intent = new Intent(MainActivity.this,SecondActivity.class);
        startActivity(intent);

    }

    @Override
    public void onAnimationCancel(Animator animation) {
        // TODO Auto-generated method stub

    }
});

布局

05-08 15:13