该文章移动到 : https://binkery.com/archives/2020.08.27-android-gridview-horizontal-vertical-space.html
GridView 提供这么两个方法 setHorizontalSpacing(int) 和 setVerticalSpacing(int)。API的DOC如下:
Set the amount of horizontal (x) spacing to place between each item in the grid.
Parameters:horizontalSpacing The amount of horizontal space between items, in pixels.
@attr ref android.R.styleable#GridView_horizontalSpacing
Set the amount of vertical (y) spacing to place between each item in the grid.
Parameters:verticalSpacing The amount of vertical space between items, in pixels.
@attr ref android.R.styleable#GridView_verticalSpacing
注意:这里设置的是 item 之间的间隔, space between items.
- EOF -
本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动。
转载请注明:文章转载自 Binkery 技术博客 [https://binkery.com]
本文标题: GridView 设置 item 间距的方法
本文地址: https://binkery.com/archives/190.html