This isn't a grid layout, I've used custom views to create this. Can anyone help me to create this with gridview . Does this even possible with GridLayout?
CodePudding user response:
You can can additional footer layout and pass other items to it.
CodePudding user response:
This might or might not be possible via GridLayoutManager
, but there is no direct solution to get this using GridLayoutManager
. I suggest you take a look at Flexbox layout manager here:
https://github.com/google/flexbox-layout
This is from Google and what you want can easily be done using it instead. You might need to play around with the properties a bit, but I think it can be done using the justifyContent
property.
A rough code snippet would be something along the lines of
RecyclerView recyclerView = (RecyclerView) context.findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
layoutManager.setFlexDirection(FlexDirection.ROW);
layoutManager.setJustifyContent(JustifyContent.SPACE_AROUND);
recyclerView.setLayoutManager(layoutManager);