android.widget.GridView

本文详细介绍了Android中GridView组件的使用方法及属性设置,包括列宽、单元格内元素对齐方式、列间距、列数量等参数的定义。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

                      android.widget.GridView

Class Overview


A view that shows items in two-dimensional scrolling grid. The items in the grid come from the ListAdapter associated with this view.

See the Grid View guide.

XML Attributes
Attribute Name Related Method Description
android:columnWidth setColumnWidth(int) Specifies the fixed width for each column.   //给每一列指定确定的宽度
android:gravity setGravity(int) Specifies the gravity within each cell.   //给每一格指定重力(比重)
android:horizontalSpacing setHorizontalSpacing(int) Defines the default horizontal spacing between columns. //定义在两列之间默认的水平间隔
android:numColumns setNumColumns(int) Defines how many columns to show. //定义要显示的列数
android:stretchMode setStretchMode(int) Defines how columns should stretch to fill the available empty space, if any. //定义了列表应当如何延伸到可用的空的空间,如果有(空间)的话
android:verticalSpacing setVerticalSpacing(int) Defines the default vertical spacing between rows. //定义了在两行之间默认的垂直间隔

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值