public class HrScrollSeeTalResDetailAdapter extends FragmentStatePagerAdapter { private List<String> list; public HrScrollSeeTalResDetailAdapter(FragmentManager fm,List<String> list) { super(fm); this.list=list; } @Override public int getCount() { if (list!=null) return list.size(); return 0; } @Override public Fragment getItem(int position) { String resumeId = list.get(position); return V4HrSeeTalentResumeDetailFragment.newInstance(resumeId); } @Override public boolean isViewFromObject(View view, Object object) { return false; } }Adapter 继承FragmentStatePagerAdapter 的时候会默认重写 isViewFromObject的方法.返回false;这就会是viewPager不显示,可以把这个重写的方法去掉.就解决问题了 具体原因看http://blog.csdn.net/harvic880925/article/details/38487149
ViewPager嵌套Fragment不显示
最新推荐文章于 2020-07-17 17:13:38 发布