您的位置:首页 > 其它

GridView 设置 item 间距的方法

2015-03-03 18:03 513 查看
GridView 提供这么两个方法 setHorizontalSpacing(int) 和 setVerticalSpacing(int)。API的DOC如下:来自Binkery技术博客,http://www.binkery.com/archives/190.html

Open Declaration void android.widget.GridView.setHorizontalSpacing(int horizontalSpacing)来自Binkery技术博客,http://www.binkery.com/archives/190.html

Set the amount of horizontal (x) spacing to place between each item in the grid.来自Binkery技术博客,http://www.binkery.com/archives/190.html

Parameters:

horizontalSpacing The amount of horizontal space between items, in pixels.来自Binkery技术博客,http://www.binkery.com/archives/190.html

@attr

ref android.R.styleable#GridView_horizontalSpacing来自Binkery技术博客,http://www.binkery.com/archives/190.html

Open Declaration void android.widget.GridView.setVerticalSpacing(int verticalSpacing)来自Binkery技术博客,http://www.binkery.com/archives/190.html

Set the amount of vertical (y) spacing to place between each item in the grid.来自Binkery技术博客,http://www.binkery.com/archives/190.html

Parameters:

verticalSpacing The amount of vertical space between items, in pixels.来自Binkery技术博客,http://www.binkery.com/archives/190.html

@attr

ref android.R.styleable#GridView_verticalSpacing来自Binkery技术博客,http://www.binkery.com/archives/190.html

注意:这里设置的是item之间的间隔,space between items.来自Binkery技术博客,http://www.binkery.com/archives/190.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: