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

Don't layout and render cut off items in single row #38

Closed
lwasyl opened this issue Nov 5, 2019 · 2 comments
Closed

Don't layout and render cut off items in single row #38

lwasyl opened this issue Nov 5, 2019 · 2 comments

Comments

@lwasyl
Copy link

lwasyl commented Nov 5, 2019

Currently with a single row and e.g. 10 children, it's possible to have just 4 items visible, fifth item visible partially and the rest hidden. One obvious use case for this behavior is with a scroll view, but I'd like to only show the fully visible items, and just drop the rest.

Is it possible that such behavior is added to the library (I can try to contribute) or maybe it's possible with the existing API? I'd like to avoid measuring the items myself (since then they'd be measured twice, by me and by the flow layout) is possible

@nex3z
Copy link
Owner

nex3z commented Nov 5, 2019

There is a app:flMaxRows attribute which sets the maximum row count.

For example, setting app:flMaxRows="1" only shows the first row even if there are more items below.

<com.nex3z.flowlayout.FlowLayout
    android:id="@+id/flow"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/box"
    app:flChildSpacing="auto"
    app:flRowSpacing="8dp"
    app:flMaxRows="1"/>

device-2019-11-05-162647

@lwasyl
Copy link
Author

lwasyl commented Nov 5, 2019

Perfect! It does work like this only with flFlow = true so I missed it initially. Thank you!

@lwasyl lwasyl closed this as completed Nov 5, 2019
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