属性动画 组合跳转界面

xml

  <ImageView
        android:id="@+id/mImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="@drawable/alibaba" />
         <!--背景图片-->`

代码实现

  private void initDongHua() {

        Animator alpha = ObjectAnimator.ofFloat(mImage, "alpha", 0, 1);
        // alpha 透明度

        Animator scaleX = ObjectAnimator.ofFloat(mImage, "scaleX", 1, 0.5f);
        // scaleX 横向缩放
        // scaleY 纵向缩放

        Animator rotationX = ObjectAnimator.ofFloat(mImage, "rotationX", 0, 360);
        //  rotationX  横向旋转
        //  rotationY  纵向旋转

        Animator translationX = ObjectAnimator.ofFloat(mImage, "translationX", -100, 0);
        //  translationX  横向平移
        //  translationY    纵向平移

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(4000);// 时长
        animatorSet.playTogether(alpha, scaleX, rotationX, translationX);
        animatorSet.start();
        // 跳转Activity
		  animatorSet.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                Intent intent =new Intent(MainActivity.this,Main2Activity.class);
                startActivity(intent);
                super.onAnimationEnd(animation);

            }
        });
    }

你可能感兴趣的:(Android)