-2

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

Jack
  • 223
  • 3
  • 13

2 Answers2

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

LayoutManager:

LinearLayoutManager llm = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);
recyclerView.setLayoutManager(llm);
Oğuzhan Döngül
  • 7,856
  • 4
  • 38
  • 52
0

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

public class CustomViewPager extends ViewPager {

public CustomViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    return false;
}

@Override
public boolean canScrollHorizontally(int direction) {
    return false;
}

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {

    return false;
}

@Override
public boolean executeKeyEvent(KeyEvent event) {
    return super.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"/>