问题
I am using recyclerview
with gridlayoutmanger
with spancount
2 containing fixed 12 elements only in recyclerview
.On tablets in landscape mode the empty space is remaining after the sixth element. I want to fill the empty space with the elements from second row. If space is there than then first row contain either 6, 7, 8 ,9 ... elements depends upon the remaining space.
回答1:
Use FlexLayoutManger with recycler view :
RecyclerView recyclerView = (RecyclerView) context.findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
layoutManager.setFlexDirection(FlexDirection.COLUMN);
layoutManager.setJustifyContent(JustifyContent.FLEX_END);
recyclerView.setLayoutManager(layoutManager);
See this link https://github.com/google/flexbox-layout#flexboxlayoutmanager-within-recyclerview
来源:https://stackoverflow.com/questions/49690257/empty-spaces-at-the-end-of-row-recyclerview-with-gridlayoutmanger