0

I am working on an android application and I want to show a button when user swipe a particular item of list.

Here is my xaml in which I have a button and few other items. I am using this xml in my list view:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="#f1eff0">


    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:visibility="visible" android:id="@+id/tb1">

        <TableRow>
            <TextView android:id="@+id/createdBy" android:typeface="normal" 
                android:singleLine="true" android:textSize="14sp" android:textStyle="bold"
                android:layout_width="wrap_content" android:textColor="#000000"
                android:layout_height="wrap_content" />
        </TableRow>
        <TableRow>
            <TextView android:id="@+id/postText" android:typeface="normal"
                android:singleLine="true" android:textSize="14sp" android:textStyle="normal"
                android:layout_width="wrap_content" android:textColor="#000000"
                android:layout_height="wrap_content" />
                <Button android:id="@+id/btnDelete" android:textColor="#ffffff" android:visible="Gone"
                android:background="@color/hover_button" android:text="Delete"
                android:textSize="14sp" android:textStyle="normal" android:typeface="normal"
                android:layout_marginLeft="320dp" />
        </TableRow>
        <TableRow>
            <TextView android:id="@+id/postDate" android:typeface="normal"
                android:singleLine="true" android:textSize="14sp" android:textStyle="normal"
                android:layout_width="wrap_content" android:textColor="#000000"
                android:layout_height="wrap_content" />
        </TableRow>
    </TableLayout>
</RelativeLayout>

I have already searched on google but could not understand the examples I am new for android please help me.

Ankit HTech
  • 1,863
  • 6
  • 31
  • 42
  • Yes [link](http://stackoverflow.com/questions/937313/android-basic-gesture-detection) this link – Ankit HTech Oct 12 '12 at 12:05
  • sooooo ? what is the precise issue ? – njzk2 Oct 12 '12 at 12:06
  • It does not work for me in my list. I mean I am unable to understand where should I put that code in my list adapter or in my class where I am adding list and in both case where to put it?? – Ankit HTech Oct 12 '12 at 12:07

2 Answers2

2

The following link will help you in implementing the swipe delete action in the listview.

Swipe delete operation in listview

Harish
  • 3,122
  • 2
  • 31
  • 46
0

I would suggest you to implement 47Degree Swipe List View (Works ultimate)

Get more information on implementing Swipe List View here,

Slide ListView Item on Android like iPhone Mail app

Need help to implement 47degree Android-SwipeListView

Accept & up-vote answers if you find them useful.

Community
  • 1
  • 1
GDroid
  • 1,254
  • 1
  • 16
  • 36