@Override
    public Object instantiateItem(ViewGroup container, int position) {
        View itemView;
        Address address = mAllAddressList.get(position);
        if (mAllImageMap.containsKey(position)) {
            View oldView = mAllImageMap.get(position);
            Object tag = oldView.getTag();
            if (null != tag && tag instanceof Address) {
                if (tag.equals(address)) {
                    itemView = oldView;
                    container.addView(itemView);
                    return itemView;
                }
            }
            container.removeView(oldView);
            mAllImageMap.remove(position);
        }

        ImageView imageView = new ImageView(mContext);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        Glide.with(mContext).load(address.getImageUrl()).into(imageView);
        imageView.setTag(address);
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        imageView.setLayoutParams(layoutParams);
        mAllImageMap.put(position, imageView);
        itemView = imageView;
        itemView.setOnClickListener(this);
        container.addView(itemView);
        return itemView;
    }
@function viewpageradapter
@auther: Created by yinglan
@time: 16/3/16
app/src/main/java/com/yinglan/scrolllayout/demo/viewpager/MainPagerAdapter.java