Android Translate 动画跳跃和缓慢移动

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) {

            }
        });

 

posted @ 2016-08-06 20:19  Charlie098765  阅读(1479)  评论(0编辑  收藏  举报