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) {
}
});
转载于:https://www.cnblogs.com/charlie098765/p/5718824.html
相关资源:Android开发之图形图像与动画(二)Animation实现图像的渐变/缩放/位移/旋转