title: Recycler View not opening within a Relative Layout. No compilation errors
body: <p>I have a fragment which is using a Relative layout. Within that XML, I have two views - a TextView and a RecyclerView</p>
  
  <p>There are no compilation errors, but the cards from the RecyclerView don't show up while running the app:</p>
  
  <p>Here's the Fragment code:</p>
  
  <pre><code>package com.hfad.bitsandpizzas;
  
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.app.Fragment;
  import android.support.v7.widget.GridLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.RelativeLayout;
  
  public class TopFragment extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          RelativeLayout layout = (RelativeLayout)inflater.inflate(R.layout.fragment_top, container, false);
          RecyclerView pizzaRecycler = (RecyclerView)layout.findViewById(R.id.pizza_recycler);
          String[] pizzaNames = new String[2];
          for(int i=0; i&lt;2; i++){
              pizzaNames[i]=Pizza.pizzas[i].getName();
          }
          int[] pizzaImages = new int[2];
          for(int i=0; i&lt;2; i++){
              pizzaImages[i]=Pizza.pizzas[i].getImageResourceId();
          }
          GridLayoutManager layoutManager = new GridLayoutManager(getActivity(),2);
          pizzaRecycler.setLayoutManager(layoutManager);
  
          CaptionedImagesAdapter adapter = new CaptionedImagesAdapter(pizzaNames, pizzaImages);
          pizzaRecycler.setAdapter(adapter);
  
          adapter.setListener(new CaptionedImagesAdapter.Listener() {
              @Override
              public void onClick(int position){
                  Intent intent = new Intent(getActivity(), PizzaDetailActivity.class);
                  intent.putExtra(PizzaDetailActivity.EXTRA_PIZZANO, position);
                  getActivity().startActivity(intent);
              }
          });
          return layout;
      }
  
  
  }
  </code></pre>
  
  <p>Here is the layout XML:</p>
  
  <pre><code>&lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity"&gt;
  
  
  &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:text="@string/title_top"
      android:id="@+id/top_text"/&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/pizza_recycler"
      android:layout_below="@+id/top_text"
      android:layout_marginTop="10dp"
      android:scrollbars="vertical"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>And here is the Adapter code:</p>
  
  <pre><code>package com.hfad.bitsandpizzas;
  
  import android.graphics.drawable.Drawable;
  import android.support.v7.widget.CardView;
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  public class CaptionedImagesAdapter extends RecyclerView.Adapter&lt;CaptionedImagesAdapter.ViewHolder&gt; {
      private String[] captions;
      private int[] imageIds;
      private Listener listener;
  
      public CaptionedImagesAdapter(String[] captions, int[] imageIds){
          this.captions = captions;
          this.imageIds = imageIds;
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder {
          private CardView cardView;
          public ViewHolder(CardView v){
              super(v);
              cardView=v;
          }
  
      }
  
      @Override
      public CaptionedImagesAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  
          CardView cv = (CardView) LayoutInflater.from(parent.getContext()).inflate(R.layout.card_captioned_image, parent, false);
          return new ViewHolder(cv);
      }
  
      @Override
      public void onBindViewHolder(ViewHolder holder, final int position) {
          CardView cardView = holder.cardView;
          ImageView imageView = (ImageView)cardView.findViewById(R.id.info_image);
          Drawable drawable = cardView.getResources().getDrawable(imageIds[position]);
          imageView.setImageDrawable(drawable);
          imageView.setContentDescription(captions[position]);
          TextView textView = (TextView)cardView.findViewById(R.id.info_text);
          textView.setText(captions[position]);
  
          cardView.setOnClickListener(new View.OnClickListener(){
              @Override
              public void onClick(View v){
                  if(listener!=null){
                      listener.onClick(position);
                  }
              }
          });
  
      }
  
      @Override
      public int getItemCount() {
          return captions.length;
      }
  
      public static interface Listener{
          public void onClick(int position);
      }
  
      public void setListener(Listener listener){
          this.listener=listener;
      }
  }
  </code></pre>
  
  <p>Thanks!</p>