This blog describe about ViewFlipper functionality in android app development. Through ViewFlipper widget can navigate from one view to another view by click event or touch event also. Through click event need Next and Previous button. through touch event need to create four animation file within animation folder.
Fundamental of touch event with X and Y co-ordinate:
onTouchEvent () method called when User performs any touch event on screen
when a User swaps from Left to Right or Right to left
user first touches on the screen ( lets say first x coordinate is x1) holds ,swaps then leaves the screen (lets say second x coordinate is x2)
so if x2> x1 it means Left to Right sweep has been performed and
if x2<x1 it means Right to Left sweep has been performed
Similarly we can track UP to Down and Down to UP swap
if y2> y1 it means UP to Down sweep has been performed and
if y2<y1 it means Down to UP sweep has been performed
main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >