Search code examples
androidandroid-layoutgesturedetector

How to control moving View over another View?


I managed to move red LinearLayout over another LinearLayout usign TranslateAnimation.

I indeed control start of animation, but not like in YouTube app or other similar apps as I have to wait until the animation finishes.

How can I gain more control over the movement of red LinearLayout?


Solution

  • You have to set an animation listener over your animation, like this

           animationRed.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
    
    
                }
            });