首页 > 移动平台 > 详细

android 竖向viewpager

时间:2020-02-20 16:25:26      阅读:87      评论:0      收藏:0      [点我收藏+]

使用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);

 

android 竖向viewpager

原文:https://www.cnblogs.com/mamamia/p/12336001.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!