Android Horizontal RecyclerView scroll Direction

前端 未结 12 2182
忘掉有多难
忘掉有多难 2020-12-12 16:26

I made a Horizontal RecyclerView and it works fine(thanks to this) but the direction of scroll and data are expand from left to right; then How can I change the RecyclerView

12条回答
  •  死守一世寂寞
    2020-12-12 16:32

    Try this

    I have tried all above answers it's showing me same vertically recycler view, so I have tried another example.

    1. Initialize the adapter

      private Adapter mAdapter;
      
    2. set the adapter like this

      mAdapter = new Adapter();
      LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
      recycler_view.setLayoutManager(linearLayoutManager);
      recycler_view.setAdapter(mAdapter);
      

    Hope this will also work for you For Complete code please refer this link

提交回复
热议问题