Skip to content

lekaha/CardDeckLayoutManager

Repository files navigation

Card Deck LayoutManager for RecyclerView

Download CircleCI

Scroll RecyclerView as scrolling a deck of cards. This library offers a custom LayoutManager to achieve it.

Add to your dependencies

dependencies {
    implementation "com.github.lekaha:carddecklayoutmanager:1.0.0"
}

How to use

val recycler = findViewById<RecyclerView>(R.id.recycler)

// revealHeight = that interval space between cards 
recycler.layoutManager = CardDeckLayoutManager(this, recycler, revealHeight)

Optional

If you would like to make your items in the list are more like card you can find this Drawable resource file And add it as your item layout background. For instance,

<androidx.constraintlayout.widget.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/bg_card"> <-- here
</androidx.constraintlayout.widget.ConstraintLayout>

preview

Known issues

  • Not yet have recycling mechanism

Preview

preview

License

See the LICENSE file for license rights and limitations (Apache license 2.0).