I cannot find out a way to add an outer margin to the GridView rows. I found the setHorizontalSpacing
and setVerticalSpacing
properties which add inner padding between the GridView rows, however it doesn't apply to the outer borders of the rows.
I'd like to have a result as it's featured on the Google Play store:
Thanks!
You can use android:clipToPadding=false
to add padding that doesn't stay when the items are scrolled. Like this
<GridView android:id="@+id/grid" android:layout_width="match_parent" android:layout_height="match_parent" android:horizontalSpacing="16dp" android:verticalSpacing="16dp" android:padding="16dp" android:clipToPadding="false" />
And if you want the scrollbar on the outside of the padding area, set android:scrollbarStyle="outsideOverlay"
thanks @Karl!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With