Apply one animation to multiple views at the same time

前端 未结 3 427
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 23:40

So Id like to rotate a handful of views all at the same time, all using the same rotation specs. The issue is that for some reason the rotation acts differently for the sec

3条回答
  •  太阳男子
    2020-12-30 00:28

    So I guess this just isn't possible, so I created a helper method to just apply the same animation to a list of views:

    public void doRotations(ArrayList views, int start, int end, int xprop, float xscale, int yprop, float yscale, int duration, Boolean fillAfter){
    
        for(int i = 0; i < views.size(); i++){
            RotateAnimation temp = new RotateAnimation(start, end, xprop, xscale, yprop, yscale);
            temp.setDuration(duration);
            temp.setFillAfter(fillAfter);
            views.get(i).startAnimation(temp);
        }
    }
    

    Definitely a hack, but I guess thats all I'm able to do right now

提交回复
热议问题