Show button in a list view on swiping one item from that list
Asked Answered
O

2

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.

Odontology answered 12/10, 2012 at 12:1 Comment(3)
Yes link this linkOdontology
sooooo ? what is the precise issue ?Ottar
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??Odontology
S
2

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

Swipe delete operation in listview

Shalandashale answered 18/10, 2012 at 11:16 Comment(0)
P
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.

Postdiluvian answered 10/12, 2013 at 4:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.