Sunday, October 23, 2011

View Flipper Example ANDROID

Flipkart.com







create new ANDROID Project :

in your res/layout/main.xml  


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/LinearLayout03"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/Button01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Next" >
        </Button>

        <Button
            android:id="@+id/Button02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Previous" >
        </Button>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/LinearLayout02"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <ViewFlipper
            android:id="@+id/ViewFlipper01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="320dp"
                android:layout_height="435dp"
                android:background="@drawable/images"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/TextView01"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Flipper Content 1" >
                </TextView>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/images"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/TextView02"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Flipper Content 2" >
                </TextView>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/images"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/TextView03"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Flipper Content 3" >
                </TextView>
            </LinearLayout>
        </ViewFlipper>
    </LinearLayout>

</LinearLayout>


now in your first Activity :