2015-01-21 24 views
1

我有兩個不同的動畫:Android AnimationSet是否會覆蓋子動畫的持續時間和插值器?

AlphaAnimation alphaAnimation = new AlphaAnimation(0f,1f); 
alphaAnimation.setDuration(1000); 
alphaAnimation.setInterpolator(new AccelerateInterpolator()); 

ScaleAnimation scaleAnimation = new ScaleAnimation(1f,2f,1f,2f); 
scaleAnimation.setDuration(3000); 
scaleAnimation.setInterpolator(new DecelerateInterpolator()); 

,我需要同步播放這動畫。

AnimationSet set = new AnimationSet(false); 
set.addAnimation(alphaAnimation); 
set.addAnimation(scaleAnimation); 
set.setDuration(5000); 
startAnimation(set); 

而且我有一個問題。我在每個動畫上設置了一些值,例如插值器持續時間。動畫集影響(覆蓋)插值器值,當我設置它AnimationSet?這個問題也給持續時間值。

回答

2

是的,是的。 AnimationSet會覆蓋「孩子」動畫的持續時間值。這是在文檔中提到的,我也進行了測試以確認。 setInterpolator沒有明確提到,但我也測試了它,並且它也覆蓋了所有子動畫的插值。