GridView的行外缘 [英] GridView rows outer margin

查看:181
本文介绍了GridView的行外缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到一个方法来一个外边添加到GridView行。我发现 setHorizo​​ntalSpacing 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

这篇关于GridView的行外缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆