android - 如何实现list的item全放到一个页面,左右滑动。
巴扎黑
巴扎黑 2017-04-17 17:41:02
0
3
493

就像是RecyclerView横向的布局方式,但是RecyclerView滑动的力度大就会跳跃好几个item,我需要一个个item滑动过去,或者有什么方法让RecyclerView可以固定每次滑动的x。请教各位啦!自己查资料好像ViewPager加上Fragment可以实现,但是不太会。求助求助求助。

巴扎黑
巴扎黑

reply all(3)
洪涛

According to your description, ViewPager should be used.

Very similar to RecyclerView, an Adapter is used to adapt it. The simplest example is in the Add a ViewPager chapter of Android Developer - Using ViewPager for Screen Slides. I think it has been made very clear. It uses Adapter as an internal class. Of course, you can also take out Adapter and make it another class.

In addition, it seems that the effect you want can refer to the following example:

  • MapViewPager

If you have any questions, please leave a comment. :-)

迷茫

Add the following four lines of code in addOnItemSelectionListener or setOnItemClickListener at the same time to achieve the effect of sliding items one by one.
recyclerView.setLayoutFrozen(true);
recyclerView.setLayoutFrozen(false);#🎜 🎜#adapter.notifyItemChanged(adapterPosition);
adapter.notifyDataSetChanged();

刘奇

After various searches, I discovered the recyclerviewpager library, which can solve the problem of single page sliding.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template