Code example for AnimatorSet

Methods: playsetDurationstart

0
		ObjectAnimator translationLeft = ObjectAnimator.ofFloat(m_tv, "X", 0f);
		ObjectAnimator translationDown = ObjectAnimator.ofFloat(m_tv, "Y",
				height);
		ObjectAnimator translationUp = ObjectAnimator.ofFloat(m_tv, "Y", 0);
 
		AnimatorSet as = new AnimatorSet();
		as.play(translationRight).before(translationLeft);
		as.play(translationRight).with(translationDown);
		as.play(translationLeft).with(translationUp);
 
		// 和上边四句等效,另一种写法 
        /* 
		AnimatorSet as = new AnimatorSet(); 
		as.playTogether(translationRight, translationDown); 
		as.playSequentially(translationRight, translationLeft); 
		as.playTogether(translationLeft, translationUp); 
        */ 
		as.setDuration(1500);
		as.start();
	} 
 
	/* 
	 * XML,便于代码重用 
	 */ 
Experience pair programming with AI  Get Codota for Java