Custom ViewPager

后端 未结 3 668
伪装坚强ぢ
伪装坚强ぢ 2021-01-06 23:20

How can i create a customized ViewPager ? To instantiate a page in the ViewPager it\'s something like this :

            public Object instantiateItem(View c         


        
3条回答
  •  囚心锁ツ
    2021-01-06 23:44

    Tsunaze is right. Also, there is another way of doing that. If you are using Fragments to set the UI View, you can use, getItem(int position), from FragmentPagerAdapter and then use onCreateView method from Fragment class.

        @Override
    public Fragment getItem(int position) {
        // TODO Auto-generated method stub
    
        Log.d(TAG, "getItem");
    
        return ImageListFragment.newInstance(position, mList);
    }
    

提交回复
热议问题