1

伙计们,我有一个如下的网格视图

view 1  view 2 view 3
view 4  view 5 view 6
......

我使用以下组件制作了这个网格视图

android:numColumns="auto_fit" 
android:columnWidth="90dp" 
android:stretchMode="columnWidth"

我想要一个底部的网格作为

view 1  view 2 view 3
view 4  view 5 view 6       (FIG 2)
V I E W 7 (completely)

我玩了上面所有的 3 个组件,但我得到了一个像

V I E W 1
 V I E W 2..

但我需要(图 2)

下面是xml

 <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"
                    android:layout_below="@+id/EmptyFonesLayout" >
 <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="wrap_content"  android:verticalSpacing="4dp" android:horizontalSpacing="4dp" android:numColumns="auto_fit" android:columnWidth="90dp" android:stretchMode="columnWidth"   android:background="#ffffff"
                android:textFilterEnabled="true" />
4

2 回答 2

0

利用

android:columnSpan="number of columns"

在您的 xml 中用于第 7 个视图

放上你的 xml 布局文件以使其更清晰

于 2012-12-13T07:35:34.220 回答
0

stretchMode 导致了这个问题。当您将stretchMode 设置为columnWidth 时。

正如文件所说

stretchMode 定义列应如何拉伸以填充可用的空白空间(如果有)。在 columnWidth 选项中,每列均被拉伸。

有关更多详细信息,请查看文档

我没有尝试过,但尝试将 stretchMode 设置为 none/spacingWidth/spacingWidthUniform 而不是 columnWidth

`<GridView
       android:stretchMode="none"
 />
于 2012-12-13T07:38:29.143 回答