title: I want the text in the middle of cardview if there is no image in ArrayList
body: <p>I have a <code>RecyclerView</code> with a <code>Cardview</code>. I got it to work if there is no image in the <code>ArrayList</code>, but it still puts the text at the bottom. </p>
  
  <p>Like this:</p>
  
  <p><a href="https://i.stack.imgur.com/K24Ra.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K24Ra.jpg" alt="This is how it looks now:"></a></p>
  
  <p>I am wondering if its possible (and if - how please) to get the text of this <code>CardView</code> in the middle if there is no image. Maybe with <code>Java</code> or in the <code>XML</code> file.</p>
  
  <p>Here is my <code>XML</code> file:</p>
  
  <pre><code>   &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;ImageView
          android:id="@+id/image"
          android:layout_width="100dp"
          android:layout_height="100dp"
          android:adjustViewBounds="true"
          android:layout_centerHorizontal="true"
          android:contentDescription="@null"
          android:src="@mipmap/ic_launcher" /&gt;
  
      &lt;TextView
          android:id="@+id/app_name"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/image"
          android:padding="5dp"
          android:gravity="center"
          android:text="@string/app_name"
          android:textStyle="bold" /&gt;
      &lt;TextView
          android:id="@+id/more_text5"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/app_name"
          android:padding="5dp"
          android:gravity="center"
          android:text="@string/app_name"
          android:textStyle="bold" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And here is the adapter:</p>
  
  <pre><code>     public class SnapRecyclerAdapter extends RecyclerView.Adapter&lt;SnapRecyclerAdapter.ReyclerViewHolder&gt; {
  
  private LayoutInflater layoutInflater;
  private Context context;
  private ArrayList&lt;Item&gt; items;
  
  public SnapRecyclerAdapter(Context context, ArrayList&lt;Item&gt; items) {
      this.layoutInflater = LayoutInflater.from(context);
      this.context = context;
      this.items = items;
  }
  
  @Override
  public ReyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View item = layoutInflater.inflate(R.layout.item_recycler_view, parent, false);
  
      return new ReyclerViewHolder(item);
  }
  
  @Override
  public void onBindViewHolder(final ReyclerViewHolder holder, int position) {
      Item item = items.get(position);
      if(holder.image == null){
          holder.image.setVisibility(View.GONE);}
      else {
      holder.image.setImageResource(item.getDrawable());
      holder.appName.setText(item.getName());
      holder.moreInfo.setText(item.getMore_info());}}
  
  @Override
  public int getItemCount() {
      return items.size();
  }
  
  class ReyclerViewHolder extends RecyclerView.ViewHolder {
      private ImageView image;
      private TextView appName;
      private TextView moreInfo;
  
      private ReyclerViewHolder(final View v) {
          super(v);
          image = (ImageView) v.findViewById(R.id.image);
          appName = (TextView) v.findViewById(R.id.app_name);
          moreInfo = (TextView) v.findViewById(R.id.more_text5);
      }
  }
  }
  </code></pre>
  
  <p>Needless to say that as always help (and patience with our new guys lol) is really appreciated. </p>