Android的我怎么可以添加多个动画一些延迟? [英] Android How can i add some delay on multiple animations?
本文介绍了Android的我怎么可以添加多个动画一些延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想是每一个动画,从下面的code,与延迟开始,像一个序列。所以,我有这个code:
What i want is that each animation, from the code below, to start with a delay, like a sequence. So i have this code:
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循环,所有子动画将立即启动。我已经与尝试:
because there is a for loop, all child animations will start instantly. I already tried with:
Thread.sleep....
Handler...
animate.setStartTime...
animate.setStartOffset...
但所有子动画立即启动
but all child animations starts instantly.
这个方法我试过循环中,而动画将无法启动:
I tried this method inside of loop, and the animations won't start:
animate.setAnimationListener(new AnimationListener(){
public void onAnimationEnd(Animation arg0) {
view.startAnimation(animate);
}
public void onAnimationRepeat(Animation arg0) {
}
public void onAnimationStart(Animation arg0) {
}
});
感谢名单提前。
推荐答案
解决方案是创建一个GridLayoutAnimationController或LayoutAnimationController。
The solution is to create a GridLayoutAnimationController or LayoutAnimationController.
这篇关于Android的我怎么可以添加多个动画一些延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文