flexbox-layout icon indicating copy to clipboard operation
flexbox-layout copied to clipboard

flexboxlayoutmanager + recyclerview It cannot be fully displayed when there is a large amount of data

Open XIAOPOPO opened this issue 2 years ago • 6 comments

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。

XIAOPOPO avatar Oct 20 '21 14:10 XIAOPOPO

Seeing the same behavior :/

TillSimon avatar Oct 14 '22 11:10 TillSimon

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.

TillSimon avatar Oct 14 '22 16:10 TillSimon

I have the same problem, is there any way to solve it?

wkp91 avatar Oct 25 '22 08:10 wkp91

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

wkp91 avatar Oct 25 '22 08:10 wkp91

I am having the same issue.

pantasystem avatar Feb 02 '23 15:02 pantasystem

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.

Kusanali-zhao avatar Feb 27 '23 06:02 Kusanali-zhao