Code example for Animation

Methods: setAnimationListener, setFillAfter, setFillBefore, setInterpolator

0
        Interpolator interpolator = new AccelerateDecelerateInterpolator();
 
        mMorphAnimation = new ToParentOriginAnimation();
        // no need to apply transformation before the animation starts, 
        // since the gadget is already in its normal place. 
        mMorphAnimation.setFillBefore(false);
        // stay in the top position after the animation finishes 
        mMorphAnimation.setFillAfter(true);
        mMorphAnimation.setInterpolator(interpolator);
        mMorphAnimation.setAnimationListener(new Animation.AnimationListener() {
            // The amount of time before the animation ends to show the search dialog. 
            private static final long TIME_BEFORE_ANIMATION_END = 80;
             
            // The runnable which we'll pass to our handler to show the search dialog. 
            private final Runnable mShowSearchDialogRunnable = new Runnable() {
                public void run() { 
                    showSearchDialog(); 
                } 
            }; 
             
            public void onAnimationEnd(Animation animation) { }