title: Android Centering Item in RecyclerView
body: <p>Im a newbie in android. Im not sure why I cant center my item in RecyclerView.</p>
  
  <p>What I want is like below image :-</p>
  
  <p><img src="https://i.stack.imgur.com/EYFqg.png" alt="Actual"></p>
  
  <p>What android render is like below image :-</p>
  
  <p><img src="https://i.stack.imgur.com/oLXbh.png" alt="Reality"></p>
  
  <p>Is there a way to push items in RecyclerView to center? So it will look like this :-</p>
  
  <p><img src="https://i.stack.imgur.com/DKYl7.jpg" alt="i want like this"></p>
  
  <p>I also provide the layout files as below :-</p>
  
  <p><strong>recycler_item.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content" android:layout_height="wrap_content"
      android:id="@+id/calendar_itemContainer"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="April"
          android:id="@+id/calendar_txtMonth"
          android:layout_alignParentTop="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:textColor="#ff58636d"
          android:textSize="16sp"
          android:gravity="center|center_vertical|center_horizontal"
          android:paddingTop="8dp"
          android:paddingLeft="12dp"
          android:paddingRight="12dp" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="21"
          android:id="@+id/calendar_txtDay"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_below="@+id/calendar_txtMonth"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:textColor="#ff58636d"
          android:textSize="40sp"
          android:layout_marginTop="-10dp"
          android:paddingLeft="10dp"
          android:paddingRight="10dp"
          android:paddingBottom="5dp"
          android:gravity="center|center_vertical|center_horizontal" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>fragment_calendar.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &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"&gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/calendar_recycler_view"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:scrollbars="horizontal"
          android:background="#ff2c3e50" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and the java codes :-</p>
  
  <pre><code>CalendarAdapter mAdapter = new CalendarAdapter(mDataset);
  mLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
  mRecyclerView.setLayoutManager(mLayoutManager);
  mAdapter.setCalendarCallbacks(this);
  mRecyclerView.setAdapter(mAdapter);
  mRecyclerView.setItemAnimator(new DefaultItemAnimator());
  selectItem(mCurrentSelectedPosition);
  </code></pre>