Measure flexBasisPercent when in a FlexBoxLayout using padding or dividerDrawable
Issues and steps to reproduce
When I used padding or dividerDrawable on FlexBoxLayout, I used the flexBasisPercent property on the child view. The width of its child views will not meet my expectations: (parentViewGroupSize-padding-dividerDrawableSize*numberOfShownDividerDrawable) * flexBasisPercent Its actual width calculation becomes: the parent viewGroup size * flexBasisPercent, which caused me to set the flexBasisPercent of 0.333 for each child view, it will not display three per line, but two or even one will wrap.
Expected behavior
flexBasisPercent should consider the maximum displayable width of all child views when calculating, not just the width of the parent view, because it contains padding and dividerDrawable.
Version of the flexbox library
2.0.0
Link to code
<com.google.android.flexbox.FlexboxLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:padding="30dp"
app:flexWrap="wrap">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_flexBasisPercent="0.33f"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_flexBasisPercent="0.33f"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_flexBasisPercent="0.33f"/>
</com.google.android.flexbox.FlexboxLayout>
or Measurement of childMainSize in the calculateFlexLines method in the FlexboxHelper file: childMainSize = Math.round(mainSize * flexItem.getFlexBasisPercent());
still not fixed, is there an easy workaround for this other than calculating the child size in the adapter?
I am currently calculating the percentage of width the padding takes and dividing the children between the remaining percentage 🤷🏻♂️