views:

71

answers:

1

So I have a fairly complex activity the parent being a linearlayout with a table with some basic info and buttons. Then a couple listviews that the user can add items to. So these listviews grow more and more as the user uses the app. The problem I'm running into is the Linearlayout is bigger then the resolution of the screen and so it needs to scroll. So the scrolling doesn't work on the Listviews. I've tried playing with changing the layout_height of the listview and its child element with no success. Is there a way to make these couple listviews expand out to the amount of children? Or am I going about this all wrong? If so what other controls can I use?

I'm open to any ideas. I really just don't know how to go about this.

Thanks

+1  A: 

The problem I'm running into is the Linearlayout is bigger then the resolution of the screen and so it needs to scroll. So the scrolling doesn't work on the Listviews.

You need to rethink the way you are building your UI, as you cannot have ListViews inside of a ScrollView.

One possibility is to put everything in the ListView, marking some rows as being non-clickable, so ListView handles your scrolling. You can use my MergeAdapter for cases like this.

CommonsWare
So I have a very complex views above my lists. Its all defined in one xml view how would I go about adding these components into the MergeAdapter? Should I create all my controls at runtime? or how should I go about this?
Jared
Define a layout XML file with the stuff that should go into the `ListView` before the contents of your regular adapter. Inflate that at runtime using `getLayoutInflater().inflate()`. Add that `View` to the `MergeAdapter`, then add your regular `Adapter`. Then put the `MergeAdapter` in the `ListView`. Once you have that working, extend the `MergeAdapter` to override the proper methods to indicate that your first "row" isn't selectable/clickable.
CommonsWare