1.动画跳跃:在动画结束的时候设置位置
Animation.AnimationListener listener = new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { // imageView.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animation animation) { flp.setMargins(0,0, 0,ViewUtil.getDimenValue(context,"y200")); imageView.setLayoutParams(flp); } @Override public void onAnimationRepeat(Animation animation) { } };
2.动画缓慢移动:在动画开始的时候设置位置
onAnimationStart()方法里面设置,eg:
Animation translateAnim = AnimationUtils.loadAnimation(context, ResourceUtil.getAnimId(context,"splash_img_translate_anim")); fadeInScaleTranslateAnim.setAnimationListener(listener); translateAnim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { flp.setMargins(0,0, 0, ViewUtil.getDimenValue(context,"y50")); imageView.setLayoutParams(flp); } @Override public void onAnimationEnd(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } });