Reputation: 492
I'm having abit of an issue and i'm not too sure how to go about solving it.
Essentially i have an activity which has a base xml layout of ScrollView and i want this activity to list some results from a Cursor. So i thought i'd use SimpleCursorAdapter... however when i got it all set up it appears that the ListView that the SimpleCursorAdapter goes into doesn't play nice being within another scrollable layout element.
I've sorta got it working programmically but i'd much rather use a ListAdapter as it will make each list entry look like a button and keep it inline with the design of the rest of the application and can handle the ids of each item and where to send the user upon clicking.
So my question is this: is there anyway to either make ListView show all the items such that it never needs to scroll, or can i change the ListView to something like a LinearLayout?
I hope that makes sense! Any help / insight / ideas are welcome! Cheers!
Upvotes: 0
Views: 981
Reputation: 15334
I agree with Shardul; trying to put a listview with a scrollview will make it impossible to scroll. Have a look at the links below to see what you can accomplish with just a ListView - a.
custom backgrounds info. custom adapters
Upvotes: 1
Reputation: 27970
You can NEVER use a scroll view and a ListView together. Its a mess! and illogical as well.
Here are some of the approaches you can use:
Another tip I can give you is you can always use an relative layout and place your listView alignParentBottom="true"
and emit the scrollView approach this will make you listview alwyas scrollable.
Upvotes: 2
Reputation: 39604
It doesn't really make sense to have a ListView
inside a ScrollView
at all. The ListView
implements it's own scroll function so it should not be used in conjunction with a ScrollView
anyway.
You should rethink your UI design.
Upvotes: 1