user5685147
user5685147

Reputation: 153

Remove padding on the sides of a GridView

I have a GridView, like:

enter image description here

However, I need to remove the padding on the sides of the GridView to create more spacing between the items, so it looks more like:

enter image description here

How can I modify my GridView to reflect my needs?

<GridView
    android:id="@+id/grid_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:numColumns="4"
    android:verticalSpacing="24dp"
    android:listSelector="@android:color/transparent"
    />

Upvotes: 1

Views: 125

Answers (2)

Iliiaz Akhmedov
Iliiaz Akhmedov

Reputation: 877

Here is what solved my problem:

 android:clipToPadding="false"

Upvotes: 1

Miguel Larios
Miguel Larios

Reputation: 11

You should check your Layout margin in which your Gridview is contained.

Upvotes: 1

Related Questions