hudomju / android-swipe-to-dismiss-undo

Android swipe-to-dismiss-undo library and sample code
MIT License
239 stars 84 forks source link

Only one component swipes off on swipe #19

Closed zubinkadva closed 8 years ago

zubinkadva commented 8 years ago

I have a list view consisting of 1 image view and 2 text views. I have successfully implemented your library. When I swipe the list item, only the first component swipes off leaving the other two as it is.

Here is my layout for list item:

`<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/mdtp_red" >

<!-- Thumbnail Image -->
<ImageView
    android:id="@+id/thumbnail"
    android:layout_width="70dp"
    android:layout_height="70dp"
    android:layout_alignParentLeft="true"
    android:paddingRight="3dp"
    android:background="@android:color/white"/>

<!-- Movie Title -->
<TextView
    android:id="@+id/name_row"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/thumbnail"
    android:layout_toRightOf="@+id/thumbnail"
    android:textSize="@dimen/name_row"
    android:textStyle="bold"
    android:textColor="@android:color/black"
    android:background="@android:color/white"
    android:paddingLeft="5dp"/>

<!-- Rating -->
<TextView
    android:id="@+id/phone_row"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/name_row"
    android:paddingTop="5dp"
    android:layout_toRightOf="@+id/thumbnail"
    android:textColor="@color/email_row"
    android:textSize="@dimen/phone_email_other_row"
    android:background="@android:color/white"
    android:paddingLeft="5dp"
    android:gravity="center_vertical"/>

<!-- Genre -->
<TextView
    android:id="@+id/email_row"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/phone_row"
    android:paddingTop="5dp"
    android:layout_toRightOf="@+id/thumbnail"
    android:textColor="@color/email_row"
    android:textSize="@dimen/phone_email_other_row"
    android:background="@android:color/white"
    android:paddingLeft="5dp"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:visibility="visible"
    android:weightSum="3"   >

    <TextView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:id="@+id/txt_delete"
        android:gravity="center_vertical"
        android:text="deleted"
        android:clickable="false"
        android:layout_weight="2"
        android:hapticFeedbackEnabled="true"
        android:textColor="@android:color/white"/>

    <TextView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:gravity="center"
        android:id="@+id/txt_undo"
        android:text="undo"
        android:clickable="false"
        android:layout_weight="1"
        android:textColor="@color/colorPrimary"/>

</LinearLayout>

`

Please help me!!

aelimill commented 8 years ago

You need to wrap them into 1 ViewGroup

zubinkadva commented 8 years ago

Can you help me out with an example.

Thanks.

zubinkadva commented 8 years ago

I managed to do it. Great library by the way. Thanks.