views:

125

answers:

2

is it possible/advisable to have a nested listview?

i.e. a listView that's contained within a row of another listview?

an example would be where my main list is displaying blog posts, and then in each row, you'd have another list view for the comments for each post (that would be collapsible)

A: 

This sound like what you're looking for? If you're not, or if this doesn't work, I would suggest having two list views: one of, say, blog posts, and the second of comments, and an action on a blog post item takes you to the second view, populated with the relevant comments.

Kris
unfortunately, we want to display the comments inline... so opening them in another activity wont work.
Ben
A: 

Is what you're looking for the ExpandableListView? Of course, that's limited to only two levels of listings (but that sounds like it would work for your needs).

kiswa
well, the thing is, that i dont want the list to be exapandible... i just want to show some nested data... i.e. the original blog post, then the 2/3 most recent comments, and perhaps followed by a 'show all comments' button...
Ben
That sounds like a different layout to me. I'd see that as a container of some kind (LinearLayout, RelativeLayout, whatever) with a TextView for the blog post, and a ListView for the comments. Just load the first few comments into the list view, and implement a click listener for the last list item which loads the remaining comments. My $.02 anyway.
kiswa
Ben