use of com.chad.library.adapter.base.listener.GridSpanSizeLookup in project BaseRecyclerViewAdapterHelper by CymChad.
the class MultiItemQuickUseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multiple_item_use);
setTitle("BaseMultiItemQuickAdapter");
setBackBtn();
RecyclerView mRecyclerView = findViewById(R.id.rv_list);
final List<QuickMultipleEntity> data = DataServer.getMultipleItemData();
final MultipleItemQuickAdapter multipleItemAdapter = new MultipleItemQuickAdapter(data);
final GridLayoutManager manager = new GridLayoutManager(this, 4);
mRecyclerView.setLayoutManager(manager);
multipleItemAdapter.setGridSpanSizeLookup(new GridSpanSizeLookup() {
@Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int viewType, int position) {
return data.get(position).getSpanSize();
}
});
mRecyclerView.setAdapter(multipleItemAdapter);
}
Aggregations