Simple Android grid example using RecyclerView with GridLayoutManager (like the old GridView)

后端 未结 5 2325
我寻月下人不归
我寻月下人不归 2020-11-22 02:03

I know that RecyclerView has replaced the functionality of the old ListView and GridView. I am looking for a very basic example that s

5条回答
  •  青春惊慌失措
    2020-11-22 02:54

    You should set your RecyclerView LayoutManager to Gridlayout mode. Just change your code when you want to set your RecyclerView LayoutManager:

    recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), numberOfColumns));
    

提交回复
热议问题