title: GridView Item in Center Android
body: <p>I am trying to set my gridview item in center. You can see in below image that first column have low margin then last column. I want make it in center so it can look good.
  <a href="https://i.stack.imgur.com/qqftN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qqftN.png" alt="enter image description here"></a></p>
  
  <p>My XML of GirdView is like below</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      android:background="?attr/colorPrimaryDark"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;TextView
          android:textColor="?attr/TextColor"
          android:layout_width="wrap_content"
          android:layout_height="@dimen/toolbar"
          android:text="Go to Page:"
          android:textStyle="bold"
          android:layout_centerHorizontal="true"
          android:gravity="center"
          android:textSize="@dimen/appName"
          android:id="@+id/title"
          android:padding="8dp" /&gt;
  
      &lt;GridView
          android:layout_gravity="center"
          android:background="?attr/colorPrimary"
          android:id="@+id/grid_dialog"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:numColumns="5"
          android:verticalSpacing="10dp"
          android:horizontalSpacing="10dp"
          android:gravity="center"
          android:layout_below="@+id/title"
          android:layout_marginTop="7dp"
          android:layout_above="@+id/dialog_dismiss"
          /&gt;
  
      &lt;TextView
          android:id="@+id/dialog_dismiss"
          android:layout_width="wrap_content"
          android:layout_height="@dimen/toolbar"
          android:text="Dismiss"
          android:textStyle="bold"
          android:textColor="?attr/TextColor"
          android:padding="8dp"
          android:textSize="@dimen/appName"
          android:gravity="center"
          android:layout_marginEnd="@dimen/lblTime"
          android:layout_marginRight="@dimen/lblTime"
          android:layout_alignParentBottom="true"
          android:layout_alignParentEnd="true"
          android:layout_alignParentRight="true"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and Item XML is like below</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"
      style="@style/SelectableItemBackground"
      android:layout_height="wrap_content"&gt;
  
          &lt;TextView
              android:textStyle="bold"
              android:textAppearance="@style/TextAppearance.AppCompat.Title.Inverse"
              android:textColor="?attr/TextColor"
              android:textSize="@dimen/appName"
              android:gravity="center"
              android:id="@+id/textview_dialogue"
              android:layout_width="@dimen/nav_but_size"
              android:layout_height="@dimen/nav_but_size"
              android:visibility="visible" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Let me know if someone can help me for come out from issue. Thanks</p>