flexbox-layout
flexbox-layout copied to clipboard
Count of FlexboxLayout changes in Recycler view After NotifyDataChange Call
- [x] I have searched existing issues and confirmed this is not a duplicate
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);
}