Rasteransicht mit zwei Spalten und automatisch angepassten Bildern

Ich versuche, eine Rasteransicht mit zwei Spalten zu erstellen. Ich meine zwei Fotos pro Reihe nebeneinander, genau wie dieses Bild.

Aber meine Bilder haben Leerzeichen dazwischen, da sie nicht die gleiche Größe haben. Hier ist was ich bekomme.

Wie Sie sehen können, verbirgt das erste Bild die Legende, die den Kontaktnamen und die Telefonnummer enthält. und die anderen Bilder werden nicht richtig gestreckt.

Hier ist meinRasteransicht XML-Datei. Wie Sie sehen könnencolumnWidth ist eingestellt auf200dp. Ich möchte, dass es automatisch erfolgt, so werden die Bilder automatisch für jede Bildschirmgröße angepasst.

<?xml version="1.0" encoding="utf-8"?>
<GridView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gridViewContacts"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:numColumns="2"
    android:columnWidth="200dp"
    android:stretchMode="columnWidth"    
    android:gravity="center" />

und hier ist die Item-XML-Datei, die jedes Item für sich darstellt.

<?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" >

    <ImageView
        android:id="@+id/imageViewContactIcon"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY" />

    <LinearLayout
        android:id="@+id/linearlayoutContactName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:paddingLeft="5dp"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:background="#99000000"
        android:layout_alignBottom="@+id/imageViewContactIcon">

        <TextView
            android:id="@+id/textViewContactName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            android:textStyle="bold"
            android:textSize="15sp"
            android:text="Lorem Ipsum" />       

        <TextView
            android:id="@+id/textViewContactNumber"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            android:layout_marginLeft="5dp"
            android:focusable="true"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:textSize="10sp"
            android:text="123456789" />

    </LinearLayout>

</RelativeLayout>

Ich möchte also zwei Bilder pro Zeile anzeigen und die Größe der Bilder automatisch ändern, unabhängig von der Bildschirmgröße. Was mache ich falsch in meinem Layout?

Vielen Dank.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage