我需要创建一个4格(或矩形)比例相同的网格
我用gridview做到了,但我无法轻松管理边距。我怎么能实现这个目标呢?
这是gridView:
android:id="@+id/activity_home_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/activity_home_search"
android:layout_marginBottom="@dimen/margin_large"
android:layout_marginLeft="@dimen/margin_large"
android:layout_marginRight="@dimen/margin_large"
android:background="@android:color/transparent"
android:gravity="center"
android:horizontalSpacing="@dimen/margin_large"
android:numColumns="2"
android:overScrollMode="never"
android:scrollbars="none"
android:stretchMode="columnWidth"
android:verticalSpacing="@dimen/margin_large"
这是细胞
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/selector_blue" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical" >
<ImageView
android:id="@+id/cell_grid_allzic_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_medium" >
</ImageView>
<TextView
android:id="@+id/cell_grid_allzic_label"
style="@android:style/TextAppearance.Medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@android:color/white" />
</LinearLayout>
</RelativeLayout>