Search code examples
androidandroid-viewpager

How is playstore app displaying multiples pages on view pager


I have tried this Multiple pages at the same time on a ViewPager, I couldn't customize it same as google play app.

My questions are. 1. Is it actually a viewpager used in google play store app? 2. How to get this done?

Any suggestions are much appreciated.

enter image description here


Solution

  • It's not a ViewPager, it is a RecyclerView which has Horizontal LinearLayout Manager and also have LinearSnapHelper

    You can use snapHelper like this:

    SnapHelper snapHelper;
    
    snapHelper = new LinearSnapHelper();
    snapHelper.attachToRecyclerView(recyclerView);
    

    LayoutManager:

    LinearLayoutManager llm = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);
    recyclerView.setLayoutManager(llm);