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

Add maxline attribute support #156

Closed
Letty-Liang opened this issue Dec 7, 2016 · 12 comments
Closed

Add maxline attribute support #156

Letty-Liang opened this issue Dec 7, 2016 · 12 comments
Assignees
Milestone

Comments

@Letty-Liang
Copy link

Letty-Liang commented Dec 7, 2016

hope to be added in order to limit the maxLines

@thagikura
Copy link
Contributor

Thanks for the suggestion, but I don't come up with an use case where the maxLines attribute is useful. Like what use case do you expect that attribute?

@ghost
Copy link

ghost commented Dec 19, 2016

First issue I had when I tried FlexBoxLayout. It would be helpful if we had this attribute. In my case I have a FlexBoxLayout on top of a RecyclerView. The FlexBoxLayout shows the names of the selected elements in the list. In my case I don't want it to be more than two lines (otherwise the FlexBox would cover the screen if I select many elements), I would show a label "+N" for the rest of the selected items.

@osipovaleks
Copy link

what about this functionality?

@Bringoff
Copy link

Bringoff commented Feb 2, 2018

So, no progress with this?

@YuriDenison
Copy link

It would be useful in my case too.
Could you please provide any ETA for this issue?

@yifleo
Copy link

yifleo commented Feb 9, 2018

Same problem, i only need one line in header of RecyclerView

@thagikura
Copy link
Contributor

I wanted to be careful for adding a feature that the original Flexbox doesn't have, but it looks like this is going to be useful for a lot of developers.
I'll add this feature on my TODO list.

@thagikura thagikura self-assigned this Feb 14, 2018
@chinahope
Copy link

Same problem, not only and
add enqueue child view to pop old child view also limit flexboxlayout max lines

@Coehill
Copy link

Coehill commented Apr 28, 2018

Also looking for this feature. I noticed that this issue is closed but it references another issue which is also closed and references this issue. Maybe you should leave this one open since it hasn't been implemented yet.

My use case is that I have is a list of items which could have only a few items or dozens. In the latter case, I don't want it to fill the entire screen and therefore need a limit to how many lines are shown.

@oyty
Copy link

oyty commented Feb 27, 2019

manager.setMaxLine(1) is useless for FlexboxLayoutManager.

private static class OnViewGlobalLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener {
    private final static int maxHeight = 130;
    private View view;

    public OnViewGlobalLayoutListener(View view) {
        this.view = view;
    }

    @Override
    public void onGlobalLayout() {
        if (view.getHeight() > maxHeight)
            view.getLayoutParams().height = maxHeight;
    }
}

add listener to RecyclerView:

view.getViewTreeObserver()
                  .addOnGlobalLayoutListener(new OnViewGlobalLayoutListener(view));

@wpq2014
Copy link

wpq2014 commented May 12, 2020

@thagikura It should be maxVisibleLines, not maxLines
maxVisibleLines

@7LPdWcaW
Copy link

7LPdWcaW commented Jun 27, 2020

How do I use maxLine whilst preserving item widths? I am essentially trying to achieve the above; add all items to wrap but only show the first line but setting maxLine squishes all items onto 1 line

Seems related to #440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests