首页

源码搜藏网

首页 > 安卓源码 > 功能分类 > 视图效果View Effects >

类似社交app tinder的滑动卡片效果安卓源码下载

创建时间:2016-08-19 11:17  

类似社交app tinder的滑动卡片效果安卓源码下载
类似社交app tinder的滑动卡片效果安卓源码下载
暂无演示 立即下载
介绍:类似社交app tinder的滑动卡片效果安卓源码,流畅,体验很好。可以用来实现滑到左边喜欢,右边不喜欢之类的功能,卡片内容的添加是用的Adapter。
运行效果:

使用说明:
youtube 视频 : https://www.youtube.com/watch?v=YsMnLJeouf8&feature=youtu.be    源码中包含视频,但是卡片内容只是普通视图,不是图片。
安装 配置
在布局文件中放入CardStack
 <com.wenchao.cardstack.CardStack
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding = "20dp"
        android:clipChildren="false"
        android:clipToPadding="false"
    />

Create your card view layout file.

Example: card_layout.xml, contain only a TextView

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
    />

</LinearLayout>

Implement your own adapter for the card stack. The CardStack will accept ArrayAdapter. The Following example extends a simple ArrayAdapter, overriding getView() to supply your customized card layout

public class CardsDataAdapter extends ArrayAdapter<String> {

    @Override
    public View getView(int position, final View contentView, ViewGroup parent){
        //supply the layout for your card
        TextView v = (TextView)(contentView.findViewById(R.id.content));
        v.setText(getItem(position));
        return contentView;
    }

}

上一篇:Android视图效果UltimateRecyclerview源代码下载
下一篇:FlycoPageIndicator实现页面指示器动画切换效果

相关内容

热门推荐