时间:2021-07-01 10:21:17 帮助过:354人阅读
public void alwaysWave() { AnimationSet as = new AnimationSet(true); ScaleAnimation sa = new ScaleAnimation(1f, ANIMATION_SCALE_MULTIPLE, 1f, ANIMATION_SCALE_MULTIPLE, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f); sa.setDuration(ANIMATION_EACH_OFFSET * 3);// sa.setRepeatCount(Animation.INFINITE);// 设置循环 sa.setRepeatCount(1);// 设置循环 sa.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { Logger.i("动画开始"); } @Override public void onAnimationEnd(Animation animation) { Logger.i("动画结束"); postDelayed(new Runnable() { @Override public void run() { alwaysWave(); } }, 800); } @Override public void onAnimationRepeat(Animation animation) { Logger.i("动画重复"); } }); AlphaAnimation aniAlp = new AlphaAnimation(0.8f, 0.1f);// aniAlp.setRepeatCount(Animation.INFINITE);// 设置循环 aniAlp.setRepeatCount(1);// 设置循环 as.setDuration(ANIMATION_EACH_OFFSET * 3); as.addAnimation(sa); as.addAnimation(aniAlp); bldot.startAnimation(as); }