android 竖向viewpager

使用recycleview 实现。

外加辅助类:

SnapHelper的使用方法
SnapHelper是一个抽象类 Google 内置了两个默认实现类,LinearSnapHelper和PagerSnapHelper。

LinearSnapHelper:使当前Item居中显示,常用场景是横向的RecyclerView, 类似ViewPager效果,但是又可以快速滑动多个条目。
LinearLayoutManager manager = new LinearLayoutManager(getContext());
manager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(manager);
LinearSnapHelper snapHelper = new LinearSnapHelper();
snapHelper.attachToRecyclerView(mRecyclerView);
PagerSnapHelper:使RecyclerView 像ViewPager一样的效果,每次只能滑动一页。

LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
mRecycleview.setLayoutManager(linearLayoutManager);
PagerSnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(mRecycleview);
原文地址:https://www.cnblogs.com/mamamia/p/12336001.html