Reputation: 2182
I want to add my Listview in another scroll view but when i add it in scrollview in xml it show only one item.so i want to create custom scroll view so i can put it in another scrollview.
Upvotes: 0
Views: 1991
Reputation: 2444
Things to take into account:
ScrollView
can only have a single child. If you want to add more of them you have to put them inside another ViewGroup
, then add it to the ScrollView
.ListView
handles its own scrolling, you should never put it inside another ScrollView
.If what you need is to have a certain number elements, a list of items included, scroll together as a single entity, you have two options:
ListView
, but a vertical LinearLayout
. It will work, but with this all your rows will be created at once and won't be recycled while scrolling, so you should only do this if you can be sure your list will have a limited number of items.ListView
as your main ViewGroup
and add to it every other element you need in the scroll as headers or footers. Upvotes: 1