Ich habe eine einfache Rasteransicht mit einem Bild auf der linken Seite und zwei Textzeilen rechts neben dem Bild. Die „rowspan“ des Bildes ist 2, um die volle Höhe der beiden Textzeilen zu verwenden:Automatisches Skalieren eines Bildes in GridView
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rowCount="2"
android:columnCount="2">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_row="0"
android:layout_rowSpan="2"
android:src="@drawable/disconnected" />
<TextView
android:id="@+id/connectionText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:layout_column="1"
android:layout_row="0"
android:layout_rowSpan="1"
android:inputType="textPersonName"
android:text="Name" />
<TextView
android:id="@+id/stateText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:layout_column="1"
android:layout_row="1"
android:layout_rowSpan="1"
android:inputType="textPersonName"
android:text="disconnected" />
</GridLayout>
Mein Problem: Ich möchte das Bild auf eine Größe Auto-Skala, die auf die Höhe passt der zwei Textzeilen, anstatt mit seiner ursprünglichen Höhe zu erscheinen. Gibt es eine Möglichkeit, das Layout automatisch ausführen zu lassen?
Danke!
Hm, aber diese Waage auf eine feste Größe von 40x40 dp und nicht dynamisch an die reale Größe der beiden Textzeilen rechts neben es!? – Elmi
Ich habe meine Antwort aktualisiert, es kann Ihnen helfen – RajatN