Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

Swipe-Deck

> 编程语言
Open source

A Tinder style Swipeable deck view for Android

791 stars0 likes0 views
WebsiteGitHub

About

A Tinder style Swipeable deck view for Android

Swipe-Deck

A Tinder style Swipeable deck view for Android

Note

I Have re written this project from the ground up as SwipeDeck2 and it is available here: https://github.com/aaronbond/SwipeDeck2

I initially hacked this together rather speedily beginning at a hackathon, as a result it wasn't really as maintainable and updateable as I would have liked. After getting almost daily emails and support requests for something I considered throwaway code I decided to re write and start again. So please if you're adventurous go and try out SwipeDeck2 and help me make it suitable for a wide range of use cases.

A Message To Developers

This project is still under considerable amount of development, as such i tend to tweak the API occasionally, if things change a little come and read the README or send me an issue. Please send me issues and pull requests if you need something fixed or have a feature you want and be sure to tell me if you find a bug!

Installation

In your repositories and dependencies section add these parameters:

groovy
dependencies {
    compile 'com.daprlabs.aaron:cardstack:0.3.1-beta0'
}

Sync Gradle and import Swipe-Deck into your project

java
import com.daprlabs.cardstack.SwipeDeck;

Example

Start by defining a card view, this can be made in the normal way in XML:

xml

    
        
        
    

You can use any type of view you like (not just a Card View) but i would recommend adding a drop shadow or border of some kind.

Next Swipe Deck takes an adapter just like you're used to with other adapter views. Here's a quick sample adapter:

…

Now we add a swipe deck to our layout:

xml

    

    

I've included some modified layouts (SwipeFrameLayout, SwipeRelativeLayout etc) for ease of use, but you can use any layout you desire. However you may not get the desired outcome unless you set android:clipChildren="false" on your containing layout. If you choose not to do this cards will be clipped as they move outside their view boundary.

Now we simply give our card deck an adapter and perhaps a callback from our Activity:

…

Deck XML Attributes

…

Features

Easily design cards and deck container in XML and have cards render over the top (or underneath) elements in your layout

xml

    

    

Indicator images for swiping left and right, simply add a left and right swipe view to your card layout and register their resource

id with swipe deck:

xml
            
            
java
        final SwipeDeckAdapter adapter = new SwipeDeckAdapter(testData, this);
        cardStack.setAdapter(adapter);
        
        cardStack.setLeftImage(R.id.left_image);
        cardStack.setRightImage(R.id.right_image);

Programatically Swipe the top card left / right:

java
        Button btn = (Button) findViewById(R.id.button);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                cardStack.swipeTopCardLeft();

            }
        });
        Button btn2 = (Button) findViewById(R.id.button2);
        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                cardStack.swipeTopCardRight();
            }
        });

Hardware Acceleration

In a future release this will be enabled by default but for now:

java
 	cardStack = (SwipeDeck) findViewById(R.id.swipe_deck);
        cardStack.setHardwareAccelerationEnabled(true);

currently this just enables rendering the cards to an offscreen buffer. It works well on every device i've tested but if you run into issues please let me know.

TODO

Lots of optimisation work Plenty of features left to add (let me know if you think of any)

Addendum

Feel free to contact me or log an issue if there's something broken or missing. I'd be happy to fix it up. This is currently very early work and you should fully expect some issues I have yet to spot. currently requires minSdkVersion 14, i haven't tested it but should easily support all the way back to sdk 12. If for some reason people want that let me know and i'll release a version.

Issues· 19 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言