flexbox-layout
flexbox-layout copied to clipboard
flexboxlayoutmanager + recyclerview It cannot be fully displayed when there is a large amount of data
Use flexboxlayoutmanager + recyclerview to load the flow layout. There is no problem with normal display when the amount of data is small, but it cannot be fully displayed when the amount of data is large. You know why?
As shown in the figure, there were more than 40 lines, but now only 20 lines are displayed。
Seeing the same behavior :/
If anyone else stumbles across this. If I see correctly, it's because of this
the amount of pixels where flex line calculation should be stopped this is needed to avoid the expensive calculation if the calculation is needed only the small part of the entire flex container. (E.g. If the flex container is the
FlexboxLayoutManager
, the calculation only needs the visible area, imposing the entire calculation may cause bad performance
I was using this for a RecyclerView
within a NestedScrollView
. Users could switch between a horizontal LinearLayoutManager
and a vertically expanded list with FlexboxLayoutManager
. But as mentioned in the code comment, this is designed to only provide a proper height calculation up to a calculated visible area. But I needed that proper height to have the RecyclerView
work correctly with wrap_content
.
Setting setNestedScrollingEnabled
to true
let users scroll within that RecyclerView
for the "missing" items. If this is not ideal, use FlexboxLayoutManager
with a standard non-wrap_content
RecyclerView
or maybe the FlexboxLayout
solves this.
I have the same problem, is there any way to solve it?
Problem and steps to reproduce
RecycleView nests RecycleView, and the internal RecycleView uses FlexboxLayoutManager(context, FlexDirection.ROW, FlexWrap.WRAP), when the number of items is large, it cannot be displayed completely (for example, only 30 items are displayed for 50 items, and they are not displayed after exceeding one screen)。
But when FlexboxLayoutManager is set to FlexDirection.COLUMN. Vertical display can all be displayed, and LinearLayoutManager or GridLayoutManager can also be used to display all
Only when FlexboxLayoutManager is set to FlexDirection.ROW is not fully displayed
Version of the flexbox library 3.0.0 and earlier
I am having the same issue.
I am having the same issue.
Does the item layout for RecyclerView use ConstraintLayout? Replacing ConstraintLayout with a RelativeLayout or LinearLayout might solve your problem.