具有3行3列的Android网格视图 [英] Android Grid view with 3 rows and 3 columns

查看:154
本文介绍了具有3行3列的Android网格视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法设置编号. 网格视图的行数.只能设置编号.列.

I unable to set no. of rows for grid view. Only able to set no. of columns.

我需要创建一个具有3行3列的网格视图.

I need to create a grid view which has 3 rows and 3 columns.

任何人都可以帮我吗.

这是我的XML布局代码:

<GridView android:id="@+id/gridView" 
   android:layout_width="match_parent" 
   android:layout_height="match_parent" 
   android:numColumns="3" 
   android:gravity="center" 
   android:stretchMode="columnWidth" > 
</GridView>

预先感谢, 迪帕克

推荐答案

将此属性添加到您的android XML

Add this attribute to your android XML

android:numColumns="3"

这将使您只有3列,并提供

This will allow you to have only 3 columns and give the

android:layout_width="match_parent"

然后添加3行可能会有所帮助.

Then add 3 rows may be it will help.

尝试一下.

这篇关于具有3行3列的Android网格视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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