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

Is there possible to calculate the size of child view on each row/column? #543

Closed
1 task done
wilspheal opened this issue Mar 27, 2020 · 1 comment
Closed
1 task done

Comments

@wilspheal
Copy link

wilspheal commented Mar 27, 2020

Issues and steps to reproduce

I want to calculate the size of the child's view before its wrapped.
I've tried to use isWrapBefore() attribute on the view like
((FlexboxLayout.LayoutParams) flexView.getLayoutParams()).isWrapBefore()
so I thought I could get the last index of the child before it wrapped while using loops but it returns false.
I notice that the layout_wrapbefore attribute doesn't work if it wrapped automatically.

Expected behavior

I hope I can explain my issue better, but here is what I want to achieve.
I just want to get the size of the children on each row before its wrapped.
Ex:
[original list] a, b, c, d, e, f, g
[0] | a b c d |
[1] | e f g . |
1st row will return 4 and the 2nd one will return 3.
Any way to do that?

Version of the flexbox library

2.0.1

@thagikura
Copy link
Contributor

After all views are laid out, it's possible but it's not possible to calculate that beforehand because it depends on the size of the device.

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

2 participants