Ben Ben - 1 year ago 167
Android Question

android nested listview

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)

Answer Source

I had the same problem today, so this is what I did to solve it:

I have a ListView, with a CustomAdapter, and on the getView of the customAdapter, I have something like this:

LinearLayout list = (LinearLayout) myView.findViewById(;

for (Music music : albums.get(position).musics) {
    View line = li.inflate(R.layout.inside_row, null);

    /* nested list's stuff */


So, resuming, It's not possible to nest to ListViews, but you can create a list inside a row using LinearLayout and populating it with code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download