ViewPager inside ListView

百般思念 提交于 2019-12-17 16:35:11

问题


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!


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/8674529/viewpager-inside-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!