Android listview, swipe to action

BoredT picture BoredT · Aug 22, 2013 · Viewed 7k times · Source

I have listview with some text. I want to show images on swipe action (almost like in gmail app). For example, if I swipe from left to right - my list item is moving right, and image is sliding from the left. My list item can move right no more than image width. After swipe stops, list item is moving to start position. How could I make such thing? example

Answer

Steve picture Steve · Jan 3, 2015

check out this.

There you can see the listview swipe to the right to show the views.

Snap:

enter image description here

main_activity.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:swipe="http://schemas.android.com/apk/res-auto"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

   <com.fortysevendeg.swipelistview.SwipeListView
            android:id="@+id/example_swipe_lv_list"
            android:listSelector="#00000000"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            swipe:swipeFrontView="@+id/front"
            swipe:swipeBackView="@+id/back"
            swipe:swipeDrawableChecked="@drawable/choice_selected"
            swipe:swipeDrawableUnchecked="@drawable/choice_unselected"
            swipe:swipeCloseAllItemsWhenMoveList="true"
            swipe:swipeMode="both"
            />

</LinearLayout>