1

我正在尝试同时在多个 ImageViews(Buttons) 上进行翻译动画。然而,每个 ImageView 的 TranslateAnimations 会有所不同,因此我将它们放在 AnimationSet 中。问题是,不知何故,动画甚至从未运行过……我不知道为什么。这是我的代码:

ArrayList<TranslateAnimation> animlist = new ArrayList<TranslateAnimation>();
AnimationSet set = new AnimationSet(true);

//The following for-loop is actually running inside two other for loops... I'm        skimming it down a little for you guys
for(int i = ROWS-1; i > row;i--){
    if(!usedFields[column][i]){
        ImageView iv = (ImageView)GameLayout.findViewWithTag(""+row+","+column);
        TranslateAnimation transanim = new TranslateAnimation(0,0,-(i-row)*letterHeight,0);
        transanim.setDuration(1000);
        iv.setAnimation(transanim);
        animlist.add(transanim);
        break;
    }
}

for (TranslateAnimation anim : animlist){
    set.addAnimation(anim);         
}

set.startNow();

谢谢你,我很感激!

4

0 回答 0