ViewPager inside ListView

Is there a way to add a viewpager as a list item?

I want to add it as a β€œheading” on top of my list before all real list items are followed. I tried to use addHeaderView () or to declare several types of view in my list adapter, however the viewpager never appears as I try.

Has anyone done something like this? Help!

+8
android android-listview listview android-viewpager
source share
2 answers

Quote from Dianne Hackborn , ViewPager "just not intended to be used as an item in a list"

+1
source share

Do not use wrap_content , try to calculate and set the size of the ViewPager programmatically, and then add the ViewPager as the ListView header.

+12
source share

All Articles