Search code examples
androidviewflipper

Android ViewFlipper flip without animation


I'm using ViewFlipper to flip views with animation. But is it to disable animation sometimes? I tried startFlipping() but failed. Any idea? Thanks.


Solution

  • Just commenting out the setInAnimation and setOutAnimation and call showNext() or showPrevious() will do the trick:

                //viewFlipper.setInAnimation(this, R.anim.slide_in_from_left);
                //viewFlipper.setOutAnimation(this, R.anim.slide_out_to_right);
                viewFlipper.showNext();
    

    Final solution:

                viewFlipper.setFlipInterval(0);
                viewFlipper.setInAnimation(null);
                viewFlipper.setOutAnimation(null);
                viewFlipper.showNext();