2016-12-20 93 views
0

我有一個viewPager在我的recyclerview任何帖子與圖像,圖像正在檢索並加載到畢加索罰款,但我的回收站視圖不顯示它。任何想法我做錯了什麼?ViewPager與畢加索不加載RecyclerView行

這裏是我的RecyclerView適配器調用ViewPager適配器

 if (posts.getPost().getImages() != null) { 

      ImagePagerAdapter pagerAdapter = new ImagePagerAdapter(mContext, posts.getPost().getImages()); 
      holder.imageViewPager.setAdapter(pagerAdapter); 

     } 

,然後這裏是我的imagePagerAdapter

public class ImagePagerAdapter extends PagerAdapter { 

private Context mContext; 
private ArrayList<PostImageBundle> postImages = new ArrayList<>(); 

public ImagePagerAdapter(Context context, ArrayList<PostImageBundle> postImageBundles) { 
    this.mContext = context; 
    this.postImages = postImageBundles; 
} 

@Override 
public int getCount() { 
    return postImages.size(); 
} 

@Override 
public void destroyItem(ViewGroup container, int position, Object object) { 
    container.removeView((LinearLayout) object); 
} 

@Override 
public boolean isViewFromObject(View view, Object object) { 
    return (view == (LinearLayout) object); 
} 

@Override 
public Object instantiateItem(ViewGroup container, int position) { 
    LayoutInflater inflater = (LayoutInflater) container.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    View view = inflater.inflate(R.layout.pager_image_item, null); 

    ImageView imageView = (ImageView) view.findViewById(R.id.imagePost); 
    Picasso.with(mContext) 
      .load(postImages.get(position).getMedium().getUrl()) 
      .into(imageView); 

    container.addView(view); 

    return view; 
} 
} 

任何想法,我做錯了嗎?

在此先感謝

回答

0

我忘了設定一個固定的高度爲我ViewPager ....這是問題