Git Product home page Git Product logo

Comments (12)

thagikura avatar thagikura commented on May 1, 2024 20

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?

from flexbox-layout.

 avatar commented on May 1, 2024 14

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.

from flexbox-layout.

wpq2014 avatar wpq2014 commented on May 1, 2024 6

@thagikura It should be maxVisibleLines, not maxLines
maxVisibleLines

from flexbox-layout.

oyty avatar oyty commented on May 1, 2024 4

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));

from flexbox-layout.

YuriDenison avatar YuriDenison commented on May 1, 2024 3

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

from flexbox-layout.

thagikura avatar thagikura commented on May 1, 2024 3

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.

from flexbox-layout.

yifleo avatar yifleo commented on May 1, 2024 2

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

from flexbox-layout.

osipovaleks avatar osipovaleks commented on May 1, 2024

what about this functionality?

from flexbox-layout.

Bringoff avatar Bringoff commented on May 1, 2024

So, no progress with this?

from flexbox-layout.

chinahope avatar chinahope commented on May 1, 2024

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

from flexbox-layout.

Coehill avatar Coehill commented on May 1, 2024

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.

from flexbox-layout.

7LPdWcaW avatar 7LPdWcaW commented on May 1, 2024

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

from flexbox-layout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.