Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

android - 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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...