title: Viewpager not showing inside RecyclerView row
body: <p>I want to make a 'Photo details' activity or fragment where i display the photo on top and below it aViewpPager that display both comments and likes of the related photo(2 tabs).
  In order to make the screen 'Scrollable' so i can scroll up/down on both comments and likes and slide left/right i decided to use a RecyclerView with 2 rows :</p>
  
  <p>ROW 1 : The photo (ImageView).</p>
  
  <p>ROW 2 : SlidingTabLayout + ViewPager + FragmentPagerAdapter.</p>
  
  <p>The code compile and run, display the image and the slidingTabLayout but not the ViewPager.</p>
  
  <p>So my two main questions are :</p>
  
  <p>1-What's wrong with my implementation.</p>
  
  <p>2-Is there an alternative or better solution for what i want to achieve ?</p>
  
  <p><strong>Note :</strong> I don't want to use a listView with header.I want to use RecyclerView because it's easier to add elements on top/bottom from network.</p>
  
  <p>PhotoDetailsActivity.java</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
      RecyclerView recyclerViewPhotoDetails;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          this.recyclerViewPhotoDetails = (RecyclerView) this.findViewById(R.id.recycler_view_photo_details);
          this.recyclerViewPhotoDetails.setLayoutManager(new LinearLayoutManager(this));
          this.recyclerViewPhotoDetails.setAdapter(new PhotoDetailsRecyclerAdapter(this.getSupportFragmentManager()));
      }
  }
  </code></pre>
  
  <p>PhotosDetailsRecyclerAdapter.java</p>
  
  <pre><code>public class PhotoDetailsRecyclerAdapter extends RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt; {
      private static final int ROW_IMAGE = 0;
      private static final int ROW_LIKES_AND_COMMENTS = 1;
      private static final int TOTAL_ROWS = 2;
  
      private FragmentManager fragmentManager;
  
      public PhotoDetailsRecyclerAdapter(FragmentManager fragmentManager) {
          this.fragmentManager = fragmentManager;
      }
  
      @Override
      public int getItemViewType(int position) {
          if (position == 0) {
              return ROW_IMAGE;
          } else {
              return ROW_LIKES_AND_COMMENTS;
          }
      }
  
      @Override
      public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          if(viewType == ROW_IMAGE) {
              View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_image, parent, false);
              return new ImageViewHolder(view);
          } else {
              View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_comments_and_likes, parent, false);
              return new CommentsAndLikesViewHolder(view);
          }
      }
  
      @Override
      public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
      }
  
      @Override
      public int getItemCount() {
          return TOTAL_ROWS;
      }
  
      public class ImageViewHolder extends RecyclerView.ViewHolder {
          public ImageViewHolder(View itemView) {
              super(itemView);
          }
      }
  
      public class CommentsAndLikesViewHolder extends RecyclerView.ViewHolder {
          private SlidingTabLayout slidingTabLayout;
          private ViewPager viewPager;
  
          public CommentsAndLikesViewHolder(View view) {
              super(view);
  
              slidingTabLayout = (SlidingTabLayout) view.findViewById(R.id.sliding_tab_layout_comments_and_likes);
              viewPager = (ViewPager) view.findViewById(R.id.view_pager_comments_and_likes);
  
              viewPager.setAdapter(new CommentsAndLikesPagerAdapter(fragmentManager));
              slidingTabLayout.setDistributeEvenly(true);
              slidingTabLayout.setViewPager(viewPager);
          }
      }
  }
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;android.support.v7.widget.RecyclerView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/recycler_view_photo_details"
      android:scrollbars="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      /&gt;
  </code></pre>
  
  <p>layout_image.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      &gt;
  
      &lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:adjustViewBounds="true"
          android:scaleType="centerCrop"
          android:src="@drawable/img"
          /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>layout_comments_and_likes.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      &gt;
  
      &lt;org.bitbucket.androidapp.SlidingTabLayout
          android:id="@+id/sliding_tab_layout_comments_and_likes"
          android:layout_width="match_parent"
          android:layout_height="48dp"
          android:background="@android:color/darker_gray"
          /&gt;
  
      &lt;android.support.v4.view.ViewPager
          android:id="@+id/view_pager_comments_and_likes"
          android:layout_height="match_parent"
          android:layout_width="match_parent"
          android:background="@android:color/holo_blue_dark"
          /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>CommentsAndLikesPagerAdapter.java</p>
  
  <pre><code>public class CommentsAndLikesPagerAdapter extends FragmentPagerAdapter {
      private static final int TOTAL_TABS = 2;
  
      private String[] tabs = { "comments", "likes" };
  
      public CommentsAndLikesPagerAdapter(FragmentManager fm) {
          super(fm);
      }
  
      @Override
      public Fragment getItem(int position) {
          if(position == 0) {
              return new CommentsFragment();
          } else {
              return new LikesFragment();
          }
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          return tabs[position];
      }
  
      @Override
      public int getCount() {
          return TOTAL_TABS;
      }
  }
  </code></pre>
  
  <p>CommentsFragment.java</p>
  
  <pre><code> public class CommentsFragment extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_comments, container, false);
          RecyclerView recyclerViewComments = (RecyclerView) view.findViewById(R.id.recycler_view_comments);
          recyclerViewComments.setLayoutManager(new LinearLayoutManager(this.getActivity()));
          recyclerViewComments.setAdapter(new CommentsRecyclerAdapter());
          return view;
      }
  }
  </code></pre>
  
  <p>fragment_comments.xml</p>
  
  <pre><code>&lt;android.support.v7.widget.RecyclerView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/recycler_view_comments"
      android:scrollbars="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      /&gt;
  </code></pre>
  
  <p>LikesFragment.java</p>
  
  <pre><code>public class LikesFragment extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_likes, container, false);
          RecyclerView recyclerViewLikes = (RecyclerView) view.findViewById(R.id.recycler_view_likes);
          recyclerViewLikes.setLayoutManager(new LinearLayoutManager(this.getActivity()));
          recyclerViewLikes.setAdapter(new LikesRecyclerAdapter());
          return view;
      }
  }
  </code></pre>
  
  <p>fragment_likes.xml</p>
  
  <pre><code>&lt;android.support.v7.widget.RecyclerView
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/recycler_view_likes"
      android:scrollbars="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      /&gt;
  </code></pre>
  
  <p>layout_comment.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:text="Comment"
          /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>layout_like.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:text="Like"
          /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>