我想要的是,從下面的代碼,每個動畫開始延遲,就像一個序列。所以我有這個代碼:Android如何在多個動畫中添加一些延遲?
public void setAnimation(){
View view;
String animation = prefs.getString("animations", "Scale");
String interpolator = prefs.getString("interpolators", "Bounce");
Animation animate = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.scale_in);
for(int i=0; i<gridView.getChildCount(); i++){
view = gridView.getChildAt(i);
view.startAnimation(animate);
}
}
因爲有一個for循環,所有兒童動畫將立即開始。我已經嘗試過:
Thread.sleep....
Handler...
animate.setStartTime...
animate.setStartOffset...
但所有兒童動畫立即開始。提前
animate.setAnimationListener(new AnimationListener(){
public void onAnimationEnd(Animation arg0) {
view.startAnimation(animate);
}
public void onAnimationRepeat(Animation arg0) {
}
public void onAnimationStart(Animation arg0) {
}
});
感謝名單:
這個方法我試過循環的內部,動畫將無法啓動。
添加一個動畫監聽器,當一個動畫完成時開始下一個 – Blundell 2012-02-18 13:11:32