• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Multiple List-Item Layouts in One ListView

Hi there,

I'm trying to write a ListActivity that displays heirarchical information in the following manner:

  • The first item in the list displays the current node in a tree of items.
  • The second item displays information about the parent of the current node (if any).
  • Every following item displays information about the children of the current item (if any).
I've worked out the logic for populating the ListView in such a manner, but I encounter problems when trying to assign each individual list item a different layout xml file. I need to do this because the first item should display much more complex information than any other list item (eg an image, video, etc), and the parent item should display differently than the children (though not necessarily more complex). The children list items will display only 'meta' information (a few TextViews).

Is this feasible, or should I simply put the information for the current item and parent item in a View separate from from the ListView?
 
Okay, so I've worked out a solution. Basically I got the program working fine in my Adapter's getView() function, but I had some layout issues in one of my xml files. All good now :)
 
If you ask a question, but then find a solution yourself, you would be a better forum member if you also shared the solution. In any case, good luck with your app.
 
Back
Top Bottom