title: Autofit image cardview in Recycler view
body: <p>I am working on <code>RecyclerView</code> to display the images in <code>CardView</code>.<br></p>
  
  <p>I use <code>GridLayoutManager</code> and i have specified 3 items in each row:</p>
  
  <p><code>mLayoutManager = new GridLayoutManager(context,3);</code></p>
  
  <p><strong>Problem:</strong> Images are <code>perfectly fitted</code> in the card view in my testing device.But if i test it in devices smaller than my testing device, right side of the cardview is getting <code>trimmed</code>.<br></p>
  
  <p>If i reduce the width in the cardview to suite the small devices,then i could see more margin in the right side in larger screens.<br></p>
  
  <p><strong>My Question:</strong></p>
  
  <p>How to design my xml layout to work for both small and large screens? i.e i don't want the right side edges of the cardview getting trimmed in smaller devices.</p>
  
  <p><strong>Grid_item.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;android.support.v7.widget.CardView
          android:layout_width="90dp"
          android:layout_height="wrap_content"
          card_view:cardCornerRadius="3dp"
          android:layout_marginTop="5dp"
          android:layout_marginLeft="5dp"
          android:layout_marginRight="5dp"
          card_view:cardElevation="0.01dp"
          android:layout_marginBottom="0dp"
          card_view:cardBackgroundColor="#E7A423"
          &gt;
          &lt;RelativeLayout
              android:id="@+id/top_layout"
              android:layout_width="90dp"
              android:layout_height="120dp"
              android:background="#000000"
              android:layout_gravity="center"&gt;
  
              &lt;ImageView
                  android:id="@+id/img_thumbnail"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:adjustViewBounds="true"
                  android:scaleType="fitXY"
                  /&gt;
  
          &lt;/RelativeLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  
  <p>
  <strong>RecyclerView.xml</strong></p>
  
  <pre><code>&lt;android.support.v7.widget.RecyclerView
      android:id="@+id/recycler_view"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_below="@+id/seperator"
      android:columnWidth="100dp"
      android:padding="10dp"/&gt;
  </code></pre>