0

Is there a way to show the items of a horizontal recyclerview aligned in center. i.e. the gravity of the list will be center_horizontal.

For example, to implement something like this:

enter image description here

Abu Ruqaiyah
  • 1,516
  • 1
  • 12
  • 20

2 Answers2

1

You could to define your custom layout manager: Android Centering Item in RecyclerView

Or if you need to get discrete scrolling here's the lib: https://android-arsenal.com/details/1/5480

Or recyclerView could be wrap_content with center aligment in parent frame: How do I make WRAP_CONTENT work on a RecyclerView

dilix
  • 3,761
  • 3
  • 31
  • 55
1

Try this code:

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