答案 0 :(得分:1)
我使用GridLayoutManager,以便您的回收站视图呈现为网格,在其构造函数参数中设置列数,例如:
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mLayoutManager = new GridLayoutManager(mContext, 7);
mRecyclerView.setLayoutManager(mLayoutManager);
// Initialize a new instance of RecyclerView Adapter instance
mAdapter = new MyAdapter(mContext, myData);
// Set the adapter for RecyclerView
mRecyclerView.setAdapter(mAdapter);
完整示例here
HIH