Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recycler view with wrap content items horizontal and vertical scroll

hi i want to make a recycler view to take items horizontal as many as the screen fit but with vertical scroll like this image as example

enter image description here

I try with StaggeredGridLayoutManager but it must specify the number of column want the column take as screen size any help will be good

like image 926
Ahmed Abdelmeged Avatar asked Sep 14 '17 13:09

Ahmed Abdelmeged


1 Answers

You can use FlexLayoutManager for this kind of design FlexLayout

Here is a example snippet to use FlexLayoutManager in RecycleView

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);

Their are many attributes to use FlexLayout Go through the documents on github

like image 178
Burhanuddin Rashid Avatar answered Nov 02 '22 23:11

Burhanuddin Rashid