效果图:
布局XML文件:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#ff0000"
android:orientation="vertical" >
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="1"
android:baselineAlignBottom="false"
android:src="@drawable/ic_launcher" />
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageView1"
android:layout_centerInParent="true"
android:layout_weight="1"
android:text="TextView" />
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#00ff00"
android:orientation="vertical" >
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/ic_launcher" />
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageView2"
android:layout_centerInParent="true"
android:text="TextView" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#0000ff"
android:orientation="vertical" >
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="1"
android:baselineAlignBottom="false"
android:src="@drawable/ic_launcher" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageView3"
android:layout_centerInParent="true"
android:layout_weight="1"
android:text="TextView" />
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#aaaaaa"
android:orientation="vertical" >
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/ic_launcher" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imageView4"
android:layout_centerInParent="true"
android:text="TextView" />