SkillAgentSearch skills...

CardStackView

📱Tinder like swipeable card view for Android

Install / Use

/learn @yuyakaido/CardStackView
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Logo

CardStackView

Platform License API AndroidArsenal CircleCI

Overview

Overview

Contents

Setup

val cardStackView = findViewById<CardStackView>(R.id.card_stack_view)
cardStackView.layoutManager = CardStackLayoutManager()
cardStackView.adapter = CardStackAdapter()

Features

Manual Swipe

ManualSwipe

Automatic Swipe

AutomaticSwipe

CardStackView.swipe()

You can set custom swipe animation.

val setting = SwipeAnimationSetting.Builder()
        .setDirection(Direction.Right)
        .setDuration(Duration.Normal.duration)
        .setInterpolator(AccelerateInterpolator())
        .build()
CardStackLayoutManager.setSwipeAnimationSetting(setting)
CardStackView.swipe()

Cancel

Manual swipe is canceled when the card is dragged less than threshold.

Cancel

Rewind

Rewind

CardStackView.rewind()

You can set custom rewind animation.

val setting = RewindAnimationSetting.Builder()
        .setDirection(Direction.Bottom)
        .setDuration(Duration.Normal.duration)
        .setInterpolator(DecelerateInterpolator())
        .build()
CardStackLayoutManager.setRewindAnimationSetting(setting)
CardStackView.rewind()

Overlay View

| Value | Sample | | :----: | :----: | | Left | Overlay-Left | | Right | Overlay-Right |

Put overlay view in your item layout of RecyclerView.

<FrameLayout
    android:id="@+id/left_overlay"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Set your left overlay -->

</FrameLayout>

| Value | Layout ID | | :----: | :----: | | Left | left_overlay | | Right | right_overlay | | Top | top_overlay | | Bottom | bottom_overlay |

Overlay Interpolator

You can set own interpolator to define the rate of change of alpha.

CardStackLayoutManager.setOverlayInterpolator(LinearInterpolator())

Paging

You can implement paging by using following two ways.

  1. Use DiffUtil.
  2. Call RecyclerView.Adapter.notifyItemRangeInserted manually.

Caution

You should NOT call RecyclerView.Adapter.notifyDataSetChanged for paging because this method will reset top position and maybe occur a perfomance issue.

Reloading

You can implement reloading by calling RecyclerView.Adapter.notifyDataSetChanged.

Stack From

| Default | Value | Sample | | :----: | :----: | :----: | | ✅ | None | StackFrom-None | | | Top | StackFrom-Top | | | Bottom | StackFrom-Bottom | | | Left | StackFrom-Left | | | Right | StackFrom-Right |

CardStackLayoutManager.setStackFrom(StackFrom.None)

Visible Count

| Default | Value | Sample | | :----: | :----: | :----: | | | 2 | VisibleCount-2 | | ✅ | 3 | VisibleCount-3 | | | 4 | VisibleCount-4 |

CardStackLayoutManager.setVisibleCount(3)

Translation Interval

| Default | Value | Sample | | :----: | :----: | :----: | | | 4dp | TranslationInterval-4dp | | ✅ | 8dp | TranslationInterval-8dp | | | 12dp | TranslationInterval-12dp |

CardStackLayoutManager.setTranslationInterval(8.0f)

Scale Interval

| Default | Value | Sample | | :----: | :----: | :----: | | ✅ | 95% | ScaleInterval-95% | | | 90% | ScaleInterval-90% |

CardStackLayoutManager.setScaleInterval(0.95f)

Max Degree

| Default | Value | Sample | | :----: | :----: | :----: | | ✅ | 20° | MaxDegree-20 | | | 0° | MaxDegree-0 |

CardStackLayoutManager.setMaxDegree(20.0f)

Swipe Direction

| Default | Value | Sample | | :----: | :----: | :----: | | ✅ | Horizontal | SwipeDirection-Horizontal | | | Vertical | SwipeDirection-Vertical | | | Freedom | SwipeDirection-Freedom |

CardStackLayoutManager.setDirections(Direction.HORIZONTAL)

Swipe Threshold

| Default | Value | Sample | | :----: | :----: | :----: | | ✅ | 30% | SwipeThreshold-30% | | | 10% | SwipeThreshold-10% |

CardStackLayoutManager.setSwipeThreshold(0.3f)

Swipe Restriction

| CanScrollHorizontal | CanScrollVertical | Sample | | :----: | :----: | :----: | | true | true | SwipeRestriction-NoRestriction | | true | false | SwipeRestriction-CanScrollHorizontalOnly | | false | true | SwipeRestriction-CanScrollVerticalOnly | | false | false | SwipeRestriction-CannotSwipe |

CardStackLayoutManager.setCanScrollHorizontal(true)
CardStackLayoutManager.setCanScrollVertical(true)

Swipeable Method

| Default | Value | Sample | | :----: | :----: | :----: | | ✅ | AutomaticAndManual | SwipeableMethod-AutomaticAndManual | | | Automatic | SwipwableMethod-Automatic | | | Manual | SwipwableMethod-Manual | | | None | SwipwableMethod-None |

CardStackLayoutManager.setSwipeableMethod(SwipeableMethod.AutomaticAndManual)

Public Interfaces

Basic usages

| Method | Description | | :---- | :---- | | CardStackView.swipe() | You can swipe once by calling this method. | | CardStackView.rewind() | You

View on GitHub
GitHub Stars2.5k
CategoryDevelopment
Updated2d ago
Forks468

Languages

Java

Security Score

100/100

Audited on Mar 30, 2026

No findings