Actually my need is to display the list view item one by one on swiping it from left
to right or right to left.
In my application my need is to show an listview items i.e an profile image(Imageview), a
TextView fortitle , another ImageView and a textview which contains some description.
This items swipe left to right and right to left based on the size of listview.
complete xml programatically using java, because we don't know the exact size
of ListView . So showing the item on by one we need to make the xml in our java
no need to make the in your code. We just need to bind the view on left and right
gesture.
android. Using this we can display the details of list view item on swipe.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/background_dark"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/tabBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/blue_gradient_header"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Dynamic swipe View"
android:textColor="@android:color/white"
android:textSize="22sp"
android:textStyle="bold"
android:typeface="sans" >
</TextView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tabBar" >
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/image"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/image"
android:background="#AAff0000"
android:padding="10dp"
android:text="Mukesh"
android:textSize="16sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/image"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="14dp"
android:background="@drawable/mukesh"
android:padding="5dp"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignLeft="@+id/image"
android:layout_below="@+id/image"
android:layout_marginBottom="30dp"
android:layout_marginTop="10dp" />
<TextView
android:id="@+id/desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:padding="8dp"
android:text="Hello ! this is an Sample code.My need is to show listview Item on swipe, one by one.For this I am using gessture listner and Fling animation."
android:textSize="14sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>