Skip to content Skip to sidebar Skip to footer

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 p

Solution 1:

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 = newLinearSnapHelper();
snapHelper.attachToRecyclerView(recyclerView);

LayoutManager:

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

Solution 2:

Yeah its a view pager with two tabs in which the swipe is disabled and the one you marked is a horizontal recycler view.

//CustomViewPager Class

publicclassCustomViewPagerextendsViewPager {

publicCustomViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
}

@OverridepublicbooleanonTouchEvent(MotionEvent event) {
    returnfalse;
}

@OverridepublicbooleancanScrollHorizontally(int direction) {
    returnfalse;
}

@OverridepublicbooleanonInterceptTouchEvent(MotionEvent event) {

    returnfalse;
}

@OverridepublicbooleanexecuteKeyEvent(KeyEvent event) {
    returnsuper.executeKeyEvent(event);
}

}

//layout

    <com.dolevel.level.utils.CustomViewPager
    android:layout_below="@id/progress_bar"
    android:background="#000000"
    android:id="@+id/stepper_viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Post a Comment for "How Is Playstore App Displaying Multiples Pages On View Pager"