Android GridView示例

Android GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. In this tutorial, we will build an image gallery using Android GridView.

Android GridView是一个ViewGroup ,用于在二维可滚动网格中显示项目。 在本教程中,我们将使用Android GridView构建图像库。

Android GridView (Android GridView)

Android GridView layout in one of the most useful layouts in android. GridView is mainly useful when we want show data in grid layout like displaying images or icons. This layout can be used to build applications like image viewer, audio or video players in order to show elements in grid manner.

Android GridView布局是android中最有用的布局之一。 当我们希望以网格布局显示数据(例如显示图像或图标)时,GridView主要有用。 此布局可用于构建诸如图像查看器,音频或视频播放器之类的应用程序,以便以网格方式显示元素。

GridView elements are not generally predefined and the data can be inserted into the layout using Adapters like ListAdapter etc. We can control the number of columns, their width, and relevant spacing.

GridView元素通常不是预定义的,可以使用ListAdapter等适配器将数据插入布局中。我们可以控制列数,列宽和相关间距。

Android GridView属性 (Android GridView Attributes)

  • android:id : This is the ID which uniquely identifies the layout

    android:id :这是唯一标识布局的ID
  • android:columnWidth : This specifies the fixed width for each column. This could be in px, dp, sp, in, or mm

    android:columnWidth :这指定每列的固定宽度。 可以是px,dp,sp,in或mm
  • android:gravity : Specifies the gravity within each cell. Possible values are top, bottom, left, right, center, center_vertical, center_horizontal etc.

    android:gravity :指定每个单元格内的重力。 可能的值是上,下,左,右,中心,center_vertical,center_horizo​​ntal等。
  • android:horizo
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值