Accordion Layout is stacked panel layout in that only one panel is visible at time but i wanted to show two panel visible at time so can we do this with accordion panel??
4 Answers
You cannot extend the existing Accordion Layout class to achieve what you are looking for. If you go through the source code, you will notice that the Accordion layout is created by extending FitLayout. Now, I quote the property of FitLayout explained in documentation:
This is a base class for layouts that contain a single item that automatically expands to fill the layout's container.
The documentation further says:
If the container has multiple panels, only the first one will be displayed.
Now, what the questioner is asking for is to display two panels at the same time. Which is simply not possible with any layout extending from FitLayout.
Other Issues:
There are some design issues with the component the questioner is planning to implement;
- What about of space will the currently displayed panels take?
- How the accordion behavior will work? When user try to access the third panel.. how does the currently open panels behave.
Possible Solution:
Now, one possible solution is to the extend a Panel with vbox layout and have all the panels in it.
Accordion layout is not designed for that. Choosing according layout for your requirement is like trying to fit sphere in a rectangle.
However, if you put a gun on my head, I quickly think about following options.
- Extend existing Accordion class (Discard. Since base is not design for that)
- Write your own magic Accordion (Apart from implementation, you have to answer Abdel Olakara mentioned issues, your self)
- Mimic the desired behavior, by stacking up two or more Accordions (Well, not a great idea, but gun is on my head).