Search code examples
androidviewflipper

How to swipe between layouts in the viewflipper?


I have a several buttons in the first layout in the viewflipper, and I would like to know how I can swipe over the buttons and switch to the second layout that is also in the viewflipper.


Solution

  • To swipe between layouts in a ViewFlipper use the following methods

    showPrevious()

    showNext()

    or

    startFlipping()

    the first two methods are derived from the parent class ViewAnimator

    For an example please refer to the following link:

    http://dj-android.blogspot.in/2012/03/view-flipper-example-android.html

    Of course in your case, you should trigger the showPrevious/showNext/startFlipping in the onClick method for your button