android FragmentPagerAdapter的“标准”配置

private class ImagePagerAdapter extends FragmentPagerAdapter {
 
        public List<ImageItem> fileList;
 
        public ImagePagerAdapter(FragmentManager fm, List<ImageItem> fileList) {
            super(fm);
            this.fileList = fileList;
        }
 
        @Override
        public int getCount() {
            return fileList == null 0 : fileList.size();
        }
        @Override
        public int getItemPosition(Object object) {
            return POSITION_NONE;
        }
        @Override
        public boolean isViewFromObject(View view, Object obj) {
            return view == ((Fragment) obj).getView();
        }
        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            Fragment fragment = ((Fragment) object);
            container.removeView(fragment.getView());
            FragmentUtils.removeFragmentRecently(getSupportFragmentManager(), fragment);
        }
        @Override
        public Fragment getItem(int position) {
            String url = fileList.get(position).getActualUrl();
            return ImageDetailFragment.newInstance(url);
        }
 
    }

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。