Bagusflyer
Bagusflyer

Reputation: 12915

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.

Upvotes: 1

Views: 1808

Answers (1)

Bagusflyer
Bagusflyer

Reputation: 12915

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();

Upvotes: 4

Related Questions