if you have static number image ( like just 4 image ) better to use LinearLayout
and set weight for each Image to fill page, but if you don't have static number you need write custom adapter and get height of display then set height if each element to (height / numberRow) in your code.
for first suggest you can use following code:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:weightSum="1">
<ImageView
android:id="@+id/imageView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_weight=".5" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_weight=".5"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_weight=".5" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
android:layout_weight=".5"/>
</LinearLayout>
but second suggest its more complicated. you need do following work:
1 - create custom adapter for gridView ( Developing a custom adapter)
2 - get screen size (How to get screen dimensions)
3 - set height of View in getView to ( height / numberRow )
and set following code to your gridView
android:numColumns="2"
this create 2 column in each row