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.