GridView with last item centered
<p>I'm doing a GridView (<strong>not dynamic</strong>), that contains 13 values and I want to put it on two columns and it looks like : </p>

<p><a href="https://i.stack.imgur.com/MfJ2E.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MfJ2E.png" alt="one"></a></p>

<p>And this is my code : </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;android.support.v7.widget.CardView 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="wrap_content"
card_view:cardCornerRadius="5dp"
card_view:cardUseCompatPadding="true" &gt;

&lt;RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"
    android:layout_gravity="center"
    android:gravity="center"&gt;

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/tvCard"
        android:text="A"
        android:layout_marginRight="@dimen/_7sdp"
        android:textSize="@dimen/_27sdp"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/ivCard"
        android:layout_toStartOf="@+id/ivCard" /&gt;

    &lt;ImageView
        android:id="@+id/ivCard"
        android:layout_width="@dimen/_20sdp"
        android:layout_height="@dimen/_28sdp"
        android:src="@mipmap/ic_launcher"
        android:scaleType="centerCrop"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"/&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p></p>

<p>And I used <code>Span</code> why isn't putting it on the middle? </p>

<pre><code>GridLayoutManager recycleLayoutManager = new GridLayoutManager(mContext, 2,GridLayoutManager.VERTICAL, false);
    recycleLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
                    // grid items to take 1 column
                    if (mList.size() % 2 == 0) {
                        return 1;
                    } else {
                        return (position == mList.size()-1) ? 2 : 1;
                    }
        }
    });
</code></pre>