1

I have an endless recycler view which I populate with data as scrolling is done. When I scroll right, it works perfectly. Problem is I can't figure out how to scroll left endlessly. If I am able to scroll, only then will I be able to populate the views with data. I have checked many similar queries on stackoverflow but all of them address endless scrolling only in right side direction or downward in the case of vertical recyclerview. For example, How to implement load more recyclerview in android. I want load more to get triggered while scrolling in either direction.

1 Answers1

1

If you want to create horizontal RecyclerView from left to right add. It's default direction.

LinearLayoutManager layoutManager
    = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);

RecyclerView myList = (RecyclerView) findViewById(R.id.my_recycler_view);
myList.setLayoutManager(layoutManager);

If you want to change the default from right to left use

LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, true);
        layoutManager.setReverseLayout(true);

You must choose the direction as you can't set scrolling to both sides . New items will be loaded to left or to right according to what you choose

Rainmaker
  • 7,673
  • 4
  • 38
  • 63