如何使用垂直图像(矩形)填充GridView,保持gridview自动调整,以便它自己选择好的列数。
这是我的网格视图和单元格:
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:gravity="center"
android:horizontalSpacing="@dimen/margin_medium"
android:numColumns="auto_fit"
android:overScrollMode="never"
android:paddingLeft="@dimen/margin_large" <!-- 16dp -->
android:paddingRight="@dimen/margin_large"
android:paddingTop="@dimen/margin_large"
android:scrollbars="none"
android:stretchMode="columnWidth"
android:verticalSpacing="@dimen/margin_medium" > <!-- 8dp -->
</GridView>
细胞
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/grid_cell_width" <!-- 359dp -->
android:layout_height="@dimen/grid_cell_height" <!-- 600dp -->
android:background="@drawable/selector_list_simple"
android:padding="@dimen/margin_small" > <!-- 4dp -->
<ImageView
android:id="@+id/cell_allzic_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleType="centerInside" >
</ImageView>
<ProgressBar
android:id="@+id/cell_allzic_loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/progress_bar_custom"
android:visibility="gone" />
</RelativeLayout>