While developing an Android application, most of us will encounter the need to integrate a section in our app where the user can switch between Views. So it should show one view which can be an ImageView
or a collection inside LinearLayout
, RelativeLayout
, etc. at a time that can be swiped/flinged to move to the next or previous item. Think of a slideshow of images or a step-based process like e-commerce checkouts. Basically whenever you want to swipe through a set of related sections but show only one at a time then you can leverage ViewFlipper or ViewSwitcher class widgets that Android provides us. The detection of gestures can be achieved with major use of the MotionEvent class but we’ll make use of GestureDetector for this article.
Continue reading “Android ViewFlipper and ViewSwitcher with GestureDetector Swipes/Flings”