花未开
花未开

Reputation: 308

Inconsistent width caused by adding items to FlexBoxLayoutManager

My project uses ContactAdapter to combine several adapters, but the main layout is FlexBoxLayoutManager, so I set FlexBoxLayoutManager for Recyclerview.

Currently, there is an adapter that has been selected, an adapter that displays the title, and an adapter that displays all items. The example picture is as follows

enter image description here

After debugging, I found that FlexBoxLayoutManager will update its flexLine list according to the current embedding point, that is, the first position is displayed, that is, the previous ones will not be updated. This also leads to no problem if the Recyclerview scrolls to the top, but if it scrolls to the bottom, the selected adapter cannot be seen above, and the FlexLine will not be updated. The adapter of the title will use the width of the first one in the next line. This is abnormal unless the FlexBoxLayoutmanager source code is modified.

enter image description here

enter image description here

I also saw that if its FlexLines is an empty list, it will be updated from the 0th one, but at this time fromIndex is 0, but toIndex will be -1. Even if I get the flexLinesInternal of FlexBoxLayoutmanager, I can't clear it, which will cause the page to not be displayed directly. Does anyone have a good solution?

Of course, if you don't find a good way, the current ChipsLayoutManager can still be used, but compared to FlexBoxLayoutManager, I personally think it will be a little laggy

Upvotes: 0

Views: 29

Answers (0)

Related Questions