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

Count of FlexboxLayout changes in Recycler view After NotifyDataChange Call #563

Open
1 task done
parmarravi opened this issue Nov 17, 2020 · 0 comments
Open
1 task done

Comments

@parmarravi
Copy link

Issues and steps to reproduce

I have a recycler view with flex layout, when the Notify data change is called the flex layout changes the row count to 3 from 4 and the text gets a break.

In an adapter, I am updating the item row with background color and font to bold when the user taps any item.

Is there a way to update or recall the flexBox layout as I think the size of the font changes thus making the layout buggy when an item is selected?

Expected behavior

the layout should get wrapped as per item in recycler view even after Ui change when notify data change is called.

Version of the flexbox library

2.0.1

Link to code

layoutManager = new FlexboxLayoutManager(context);
layoutManager.setFlexDirection(FlexDirection.ROW);
layoutManager.setJustifyContent(JustifyContent.SPACE_EVENLY);
layoutManager.setAlignItems(AlignItems.CENTER);
layoutManager.setFlexWrap(FlexWrap.WRAP);
recyclerViewMoods.setLayoutManager(layoutManager);

Adapter Code

 ViewGroup.LayoutParams lp = moodButtonTag.getLayoutParams();
            if (lp instanceof FlexboxLayoutManager.LayoutParams) {
                FlexboxLayoutManager.LayoutParams flexboxLp = (FlexboxLayoutManager.LayoutParams)  moodButtonTag.getLayoutParams();
                // flexboxLp.setFlexGrow(1.0f);
                //flexboxLp.setFlexShrink(1.0f);
                //  flexboxLp.setAlignSelf(AlignItems.STRETCH);
                // flexboxLp.set(JustifyContent.SPACE_EVENLY);
                flexboxLp.setAlignSelf(AlignItems.FLEX_START);
            }
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

1 participant