0

I want to create a swipeable ListView that swipes to both right and left, and I want to use a library for that in my project, but I don't find a suitable library. Can you help me?

enter image description here

enter image description here

Hadas Kaminsky
  • 1,285
  • 1
  • 16
  • 39
T.Phong
  • 21
  • 8
  • https://stackoverflow.com/a/36794681/5156075 – John Joe Jul 16 '18 at 02:53
  • Possible duplicate of [Android ListView Swipe Right and Left to Accept and Reject](https://stackoverflow.com/questions/30908068/android-listview-swipe-right-and-left-to-accept-and-reject) – Vidhi Dave Jul 16 '18 at 04:12

1 Answers1

2

I usually use Swipe Layout from Rambler Digital Solution. You can check this link: https://github.com/rambler-digital-solutions/swipe-layout-android

Add to your project:

compile 'ru.rambler.android:swipe-layout:1.0.15'

And here is the basic layout for your list item:

<ru.rambler.libs.swipe_layout.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/item_height">

<!--CENTER. app:gravity="center" - is default value -->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    ...
</LinearLayout>

<!--RIGHT-->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:gravity="right"
    app:bring_to_clamp="150dp"
    app:clamp="self"        
    app:sticky="100dp">

    ...
</LinearLayout>

<!--LEFT-->
<FrameLayout
    android:layout_width="200dp"
    android:layout_height="match_parent"
    app:gravity="left"
    app:bring_to_clamp="100dp"
    app:clamp="self"        
    app:sticky="none">

    ...
</FrameLayout>

Liar
  • 1,235
  • 1
  • 9
  • 19