adgvcxz / CardLayoutManager

A custom layoutManager providing a Tinder-like cards effect.
Apache License 2.0
40 stars 9 forks source link
card-swipe layoutmanager recyclerview

CardLayoutManager

简单、可扩展的一个LayoutManager,实现了类似于探探和Tinder,滑动图片

预览

滑动smoothScrollToPosition

初始化

CardLayoutManager layoutManager = new CardLayoutManager();
recyclerView.setLayoutManager(layoutManager);
new CardSnapHelper().attachToRecyclerView(recyclerView);

监听滑动事件

layoutManager.setOnCardSwipeListener(new OnCardSwipeListener() {
    ......
}

自定义滑动控制

如果只是在smoothScrollToPosition不想随机卡片的起点和终点可以继承BaseCardSwipeController重写其中的方法

如果想完全控制整个滑动,则需要继承CardSwipeController实现其中所有方法

导入

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    compile 'com.github.adgvcxz:cardlayoutmanager:0.2.1'
}

感谢

ChipsLayoutManager

FanLayoutManager

LICENSE

Copyright 2016 adgvcxz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.