- 监听滑动中的事件与动画过程
- 支持
smoothScrollToPosition
和scrollToPosition
- 自定义
LinearLayout.HORIZONTAL
或者LinearLayout.VERTICAL
- 自定义显示卡片个数以及卡片之间的间隙
- 自定义显示卡片的排列方向:
LEFT
RIGHT
TOP
BOTTOM
- 自定义滑动方向:
setVerticalSwipe
setHorizontalSwipe
- 对滑动过程进行控制
- 简单易用,扩展性高
滑动
和 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'
}
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.