Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save senamit2708/1e2381f2df5117e31bc488c0eb56fbb6 to your computer and use it in GitHub Desktop.
Save senamit2708/1e2381f2df5117e31bc488c0eb56fbb6 to your computer and use it in GitHub Desktop.
Horizontal Recyclerview to scroll behavior like viewpager...one page and after sliding its showing next page
private void bindView(View view) {
recyclerView = view.findViewById(R.id.recyclerview);
mLayoutManager = new LinearLayoutManager(context);
((LinearLayoutManager) mLayoutManager).setOrientation(LinearLayoutManager.HORIZONTAL);
mAdapter = new QuizQuestionAdap(context, this);
SnapHelper snapHelper = new PagerSnapHelper();
snapHelper.attachToRecyclerView(recyclerView);
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setAdapter(mAdapter);
}
https://stackoverflow.com/questions/29134094/recyclerview-horizontal-scroll-snap-in-center
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment