title: RecyclerView cutting off sides of CardView
body: <p><a href="https://i.stack.imgur.com/O6tnY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O6tnY.png" alt="enter image description here"></a>I have a RecyclerView that programmatically inflates CardViews. The left side of the card is getting cut off and they are not centered. If you need any more code posted, I would be happy to do so.</p>
  
  <p>Here is some helpful code:</p>
  
  <p>Activity:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_height="match_parent"
      android:layout_width="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"
      tools:context=".Activity.ClassRoster"
      tools:showIn="@layout/activity_class_roster"
      android:orientation="vertical"
      android:gravity="center"&gt;
  
  &lt;android.support.v7.widget.RecyclerView android:id="@+id/roster_recycler"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingStart="16dp"
      android:paddingEnd="16dp"
      android:paddingTop="16dp"
      android:clipToPadding="false"
      android:scrollbars="vertical"
      android:gravity="center"/&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Cards being inflated:</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:id="@+id/student_card_linlayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      android:gravity="center"&gt;
  
  &lt;android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:id="@+id/student_card"
      android:layout_width="@dimen/student_card_width"
      android:layout_height="@dimen/student_card_height"
      android:layout_marginBottom="8dp"
      android:layout_marginEnd="8dp"
      card_view:cardUseCompatPadding="true"
      card_view:cardPreventCornerOverlap="false"
      android:clickable="true"
      android:foreground="@drawable/custom_bg"
      card_view:cardCornerRadius="@dimen/student_card_radius"
      card_view:cardElevation="@dimen/student_card_elevation"&gt;
  
      &lt;RelativeLayout android:id="@+id/card_layout"
          android:background="@color/a"
          android:layout_width="match_parent"
          android:layout_height="160dp"&gt;
  
          &lt;TextView android:id="@+id/student_name"
              android:layout_width="wrap_content"
              android:layout_height="100dp"
              android:textColor="@android:color/white"
              android:text="TS"
              android:textSize="@dimen/student_card_text_size"
              android:gravity="center"
              android:textIsSelectable="false"
              android:layout_centerVertical="true"
              android:layout_centerHorizontal="true" /&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;android.support.v7.widget.Toolbar android:id="@+id/card_toolbar"
          android:layout_height="wrap_content"
          android:layout_width="match_parent"
          android:layout_gravity="bottom"&gt;
  
          &lt;ImageView android:id="@+id/student_delete"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="bottom|end"
              android:layout_marginBottom="25dp"
              android:layout_marginEnd="5dp"
              android:src="@drawable/ic_delete_black_24dp"/&gt;
  
          &lt;ImageView android:id="@+id/student_absent"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="bottom|start"
              android:layout_marginBottom="25dp"
              android:src="@drawable/ic_change_history_black_24dp"/&gt;
  
      &lt;/android.support.v7.widget.Toolbar&gt;
  
  &lt;/android.support.v7.widget.CardView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>