Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
XIAOPOPO opened this issue Oct 20, 2021 · 6 comments

Comments

@XIAOPOPO
Copy link

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。

@TillSimon
Copy link

Seeing the same behavior :/

@TillSimon
Copy link

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.

@wkp91
Copy link

wkp91 commented Oct 25, 2022

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

@wkp91
Copy link

wkp91 commented Oct 25, 2022

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

@pantasystem
Copy link

I am having the same issue.

@Kusanali-zhao
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants