Note that there are some explanatory texts on larger screens.

plurals
  1. POMulti-layered ExpandableListView
    primarykey
    data
    text
    <p>I'm currently working on a project in which I need something like the following:</p> <pre><code>- MainGroup 1 (Expandable) - SubGroup 1 (Expandable) - SubSubGroup 1 (Expandable) - Child View - Child View - ... - SubSubGroup 2 (Expandable) - Child View - Child View - ... - SubGroup 2 (Expandable) - SubSubGroup 3 (Expandable) - Child View - ... - SubSubGroup 4 (Expandable) - Child View - ... - SubGroup 3 (Expandable) - Child View - ... - MainGroup 2 (Expandable) - ... </code></pre> <p>At most it would be an <code>ExpandableListView</code> inside an <code>ExpandableListView</code> inside an <code>ExpandableListView</code> - so 3 layers of <code>ExpandableListView</code>:</p> <ul> <li><code>MainGroup</code> would only hold other <code>ExpandableListView</code>.</li> <li><code>SubGroup</code> would hold other <code>ExpandableListView</code> except for the last two, which will allways just be <code>ChildViews</code>. (I'm thinking those two could just be substituted with the one for <code>SubSubGroup</code>)</li> <li><code>SubSubGroup</code> would allways hold <code>ChildViews</code>.</li> </ul> <p>My problem is that I think I fail to understand the basic principles of how the <code>ExpandableListView</code> layouts it's children. I've looked at examples like <a href="http://mylifewithandroid.blogspot.com/2011/02/3-level-expandable-lists.html">this</a>, but can't get my head around the functionality.</p> <p>I've tried simply adding an <code>ExpandableListView</code> as a child in another - but something doesn't work as only the first item of the inner <code>ExpandableListView</code> is visible if you expand one of the outer groups. I can however by setting the height of the outer groups container manually make it big enough to show all items in the inner <code>ExpandableListView</code>. To be optimal, calculation of height should of course be done on the fly.</p> <p>So, to get to some more solid questions:</p> <ul> <li>Can someone give me an explanation of the <code>ExpandableListView</code> "lifecycle" (by this I mean instantation, re-use of views, expand/collapse listeners) including: <ul> <li>How and when is an <code>ExpandableListView</code> notified that a child is expanded/collapsed?</li> <li>How does the <code>ExpandableListView</code> know how much space to make for all children to fit into a group container?</li> </ul></li> <li>How much benefit is there in using the <code>ExpandableListView</code> to create the above, compared to just mixing together my own solution using some <code>LinearLayouts</code> and some <code>OnClickListeners</code>?</li> </ul> <hr> <p><strong>Edit</strong></p> <p>For my last question I might note that there can be anywhere from 1 to 20+ <code>MainGroups</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload