dnkoutso
dnkoutso

Reputation: 6061

ViewPager inside ListView

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

I want to add it as a "header" on top of my listview before all real list items follow. I tried using addHeaderView() or declaring multiple view types in my list adapter, however, the viewpager never shows up whatever way I try.

Has anyone done something similar? Help!

Upvotes: 8

Views: 8320

Answers (2)

Wayne
Wayne

Reputation: 6449

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

Upvotes: 12

CommonsWare
CommonsWare

Reputation: 1006614

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

Upvotes: 1

Related Questions