我无法找到一个方法来一个外边添加到GridView行。我发现 setHorizontalSpacing
和 setVerticalSpacing
里面加在GridView行之间的内部填充性,但它并不适用于行的外部边界。
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.
我想有它的特色在谷歌Play商店的结果:
I'd like to have a result as it's featured on the Google Play store:
谢谢!
您可以使用安卓clipToPadding = FALSE
来添加填充不停留在项目滚动。像这样
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" />
如果你想在滚动条上的填充区域外,设置安卓!scrollbarStyle =outsideOverlay
感谢@Karl