这是我目前的GridView的图像:机器人 - 如何gridview的拉伸,以填补宽度
这就是我想:
这是我griview布局:
<GridView
android:id="@+id/gridView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:columnWidth="100dp"
android:drawSelectorOnTop="true"
android:gravity="center"
android:numColumns="2"
android:stretchMode="spacingWidthUniform"
android:verticalSpacing="5dp" >
</GridView>
这是我的自定义行:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical"
>
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter" >
</ImageView>
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:includeFontPadding="false"
android:singleLine="true"
android:lineSpacingExtra="5dp"
android:textSize="12sp" >
</TextView>
我试过3个小时左右,我不能和上面的代码是我最新的代码。你可以帮帮我吗 ?我怎样才能让2行填充宽度?
感谢
请看看[两列和自动调整图像的GridView](http://stackoverflow.com/questions/15261088/gridview-with-two-columns-and-auto -resized图像) – Smeet 2015-12-24 17:50:42