views:

31

answers:

1

I have 2 ListView in a layout. I want each ListView show all their items. And scroll the whole layout.

A: 

A answer from one of the ListView Developers from the GoogleIO is: Never put a ListView in a ScrollView. This means if you want a ListView that is not scrolling as you are trying to do you maybe don't need a listview at all.

You could create a ListView put a Linearlayout in it and use the Adapters from the two Listviews to manually add the items of the list via linearlayout.addView Now you have one scrollable view that contains all items of the list. Because there is no recycling and only loading of the items in the list this is very inefficient and only usable if you don't have that much items.

The second more complicated way that you can go if you have say 20 items in each list is to use a custom adapter that takes the two listadapters and let you put all the items in one list.

Janusz