How to implement horizontal gridlayoutmanager

前端 未结 2 1899
暖寄归人
暖寄归人 2020-12-14 18:07

How to implement horizontal gridlayoutmanager with recyclerview. Fixed row count. and horizontal scroll. Like this...

        gridLayoutManager = ne         


        
相关标签:
2条回答
  • 2020-12-14 18:36

    I just add the affirmation. This picture might proof that Recyclerview with GridLayoutmanager is available for horizontal.

    0 讨论(0)
  • 2020-12-14 18:44
    1. Implement RecyclerAdapter, ViewHolder.
    2. Instantiate RecyclerAdapter, set its' adapter.
    3. Specify ROWSCOUNT (there are 3 rows on your picture): GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), ROWSCOUNT, GridLayoutManager.HORIZONTAL, false);

    4. Set layout manager: recyclerView.setLayoutManager(gridLayoutManager);

    5. Show your recycler view setContentView(recyclerView);

    I've prepared a sample for you, check it out

    0 讨论(0)
提交回复
热议问题