Home > Mobile >  Grid layout manager with dynamic item
Grid layout manager with dynamic item

Time:04-19

i use grid layout manager but not working good for dynamic item

what i want: enter image description here or just like enter image description here

and What it shows: enter image description here

CodePudding user response:

use StaggeredGridLayoutManager

recyclerView.setLayoutManager(new 
         StaggeredGridLayoutManager(2, 
         StaggeredGridLayoutManager.VERTICAL));

CodePudding user response:

Try this one

RecyclerView recyclerView = (RecyclerView) 
context.findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
layoutManager.setFlexDirection(FlexDirection.COLUMN);
layoutManager.setJustifyContent(JustifyContent.FLEX_END);

https://github.com/google/flexbox-layout

recyclerView.setLayoutManager(layoutManager);

  • Related