Android 单个按钮的缩放动画
我是android编程新手 我要做的是在我的行中逐个缩放按钮。 但现在发生的是,它们都在同一时间扩展Android 单个按钮的缩放动画,android,button,scaleanimation,Android,Button,Scaleanimation,我是android编程新手 我要做的是在我的行中逐个缩放按钮。 但现在发生的是,它们都在同一时间扩展 for(int xcnt = 1; xcnt < 9; ){ RelativeLayout box = (RelativeLayout) buttonBoxes.get(xcnt); Animation animscale = new ScaleAnimation(1f, 1.5f, 1f, 1.5f, Animation.REL
for(int xcnt = 1; xcnt < 9; ){
RelativeLayout box = (RelativeLayout) buttonBoxes.get(xcnt);
Animation animscale = new ScaleAnimation(1f, 1.5f, 1f, 1.5f,
Animation.RELATIVE_TO_SELF, (float)0.5,
Animation.RELATIVE_TO_SELF, (float)0.5);
animscale.setDuration(2000);
animscale.setStartOffset(1000); // pause for 1 second
animscale.setRepeatMode(ValueAnimator.REVERSE);
box.startAnimation(animscale);
animscale.setStartOffset(1000); // pause for 1 second
xcnt = xcnt +1;
}
for(int-xcnt=1;xcnt<9;){
RelativeLayout box=(RelativeLayout)按钮盒.get(xcnt);
动画animscale=新缩放动画(1f、1.5f、1f、1.5f、,
Animation.RELATIVE_TO_SELF,(float)0.5,
Animation.RELATIVE_TO_SELF,(float)0.5);
animscale.setDuration(2000年);
animscale.setStartOffset(1000);//暂停1秒
animscale.setRepeatMode(值animator.REVERSE);
框。startAnimation(animscale);
animscale.setStartOffset(1000);//暂停1秒
xcnt=xcnt+1;
}
问题是循环的(索引1到9)将在几微秒内执行。所有动画
将立即启动,延迟微秒
。设置setStartOffset
作为1000ms
不会在视觉上产生很大变化
尝试将偏移时间更改为xcnt*1000
animscale.setStartOffset(1000 * xcnt);