Property animation disappears to the right and comes out to the left

public void ivGoneRight(){  
       ObjectAnimator objAnim_alpha = ObjectAnimator.ofFloat(mSevice,"alpha",1f, 0f);//iv,"alpha",0f, 1f, 0f, 1f  
       ObjectAnimator objAnim_translationX = ObjectAnimator.ofFloat(mSevice,"translationX",0f, 130f);  
       //ObjectAnimator objAnim_translationY = ObjectAnimator.ofFloat(iv,"translationY",0f, 100f, 0f, 200f, 0f);  
       //ObjectAnimator objAnim_rotation = ObjectAnimator.ofFloat(iv,"rotation",0f, 180f, 0f, 360f, 0f);  
       //ObjectAnimator objAnim_scaleX = ObjectAnimator.ofFloat(iv,"scaleX", 4f, 1f, 2f, 1f);  
       //ObjectAnimator objAnim_scaleY = ObjectAnimator.ofFloat(iv,"scaleY",1f, 5f, 2f, 1f);  
       AnimatorSet animSet = new AnimatorSet();  
       animSet.play(objAnim_translationX)  
           // .before(objAnim_rotation) //Execute after play animation  
           // .after(objAnim_scaleX) //Execute before play animation  
           // .after(objAnim_scaleY)  
           // .with(objAnim_translationX) //Execute simultaneously with play animation  
           .with(objAnim_alpha);  
       setDuration(800);  
       animSet.start();  
  
  
       /** AnimationSet animationSet = new AnimationSet(true);
        //Create an AlphaAnimation object with parameters ranging from full transparency to full opacity
        AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0);
        //Set the animation execution time
        alphaAnimation.setDuration(1000);
        //Add the alphaAnimation object to the AnimationSet
        animationSet.addAnimation (alphaAnimation);
 
 
        TranslateAnimation animatranslate = new TranslateAnimation(0,500,0,0);//view.getHeight()
        animatranslate.setDuration (1500);
        animatranslate.setFillAfter(true);
        animatranslate.setInterpolator(new AccelerateInterpolator());
        animationSet.addAnimation (animatranslate);
 
        animationSet.setAnimationListener (new AnimationListener () {
 
       @Override
       public void onAnimationStart(Animation animation) {
       // TODO Auto-generated method stub
 
       }
 
       @Override
       public void onAnimationRepeat(Animation animation) {
       // TODO Auto-generated method stub
 
       }
 
       @Override
       public void onAnimationEnd(Animation animation) {
       // TODO Auto-generated method stub
       mSevice.setVisibility(View.GONE);
       mSevice.invalidate();
       mSevice.clearAnimation();
 
       }
       });
 
        //Use ImageView's startAnimation method to perform animation
        mSevice.startAnimation (animationSet); * /  
   }  
  
  
   public void ivVisibilityLeft(){  
  
       ObjectAnimator objAnim_alpha = ObjectAnimator.ofFloat(mSevice,"alpha",0f,1f );//iv,"alpha",0f, 1f, 0f, 1f  
       ObjectAnimator objAnim_translationX = ObjectAnimator.ofFloat(mSevice,"translationX",130f, 0f);  
       //ObjectAnimator objAnim_translationY = ObjectAnimator.ofFloat(iv,"translationY",0f, 100f, 0f, 200f, 0f);  
       //ObjectAnimator objAnim_rotation = ObjectAnimator.ofFloat(iv,"rotation",0f, 180f, 0f, 360f, 0f);  
       //ObjectAnimator objAnim_scaleX = ObjectAnimator.ofFloat(iv,"scaleX", 4f, 1f, 2f, 1f);  
       //ObjectAnimator objAnim_scaleY = ObjectAnimator.ofFloat(iv,"scaleY",1f, 5f, 2f, 1f);  
       AnimatorSet animSet = new AnimatorSet();  
       animSet.play(objAnim_translationX)  
           // .before(objAnim_rotation) //Execute after play animation  
           // .after(objAnim_scaleX) //Execute before play animation  
           // .after(objAnim_scaleY)  
           // .with(objAnim_translationX) //Execute simultaneously with play animation  
           .with(objAnim_alpha);  
       setDuration(800);  
       animSet.start();  
  
  
  
  
  
  
       /**  AnimationSet animationSet = new AnimationSet(true);
        //Create an AlphaAnimation object with parameters ranging from full transparency to full opacity
        AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
        //Set the animation execution time
        alphaAnimation.setDuration(3000);
        //Add the alphaAnimation object to the AnimationSet
        animationSet.addAnimation (alphaAnimation);
 
 
        TranslateAnimation  animatranslate = new TranslateAnimation(500,0,0,0);//view.getHeight()
        animatranslate.setDuration (1500);
        animatranslate.setFillAfter(true);
        animatranslate.setInterpolator(new  AccelerateInterpolator());
        animationSet.addAnimation (animatranslate);
 
        animationSet.setAnimationListener (new AnimationListener () {
 
       @Override
       public void onAnimationStart(Animation animation) {
       // TODO Auto-generated method stub
 
       }
 
       @Override
       public void onAnimationRepeat(Animation animation) {
       // TODO Auto-generated method stub
 
       }
 
       @Override
       public void onAnimationEnd(Animation animation) {
       // TODO Auto-generated method stub
       mSevice.setVisibility(View.VISIBLE);
       mSevice.invalidate();
       mSevice.clearAnimation();
       }
       });
 
        //Use ImageView's startAnimation method to perform animation
        mSevice.startAnimation (animationSet); * /  
   }  
[java] view plain copy
/********************Monitor ScrollView to stop swiping************************* ****/  
        mScrollView.setOnTouchListener(new OnTouchListener() {  
            @Override  
            public boolean onTouch(View view, MotionEvent event) {  
                switch (event.getAction()) {  
                    case MotionEvent.ACTION_DOWN:  
                        mFirstY = event.getY();  
                        Timber.e("======Press "+mCurrentY);  
                        break;  
                    case MotionEvent.ACTION_MOVE:  
                        mCurrentY = event.getY();  
                        //float fromXDelta, float toXDelta, float fromYDelta, float toYDelta  
                        Timber.e("移动========"+mCurrentY+"==iv.getHeight()==="+mSevice.getHeight());  
                        if(mFirstY!=mFirstY1){  
                            if(mShow){  
                                ivGoneRight();  
                                mShow=false;  
                            }  
                        }  
  
  
                        break;  
  
                    case MotionEvent.ACTION_UP:  
                        Timber.e("停止"+mFirstY+"=====");  
                        mFirstY1 = event.getY ();  
                        if(mFirstY!=mFirstY1){  
                            if(!mShow){  
                                timeHandler.sendEmptyMessageDelayed (11031,1000);  
                            }  
                        }  
                        break;  
                    default:  
                        break;  
                }  
                return false;  
            }  
        });  


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325925700&siteId=291194637