Ich verwende 2 innere Linearlayouts, um meinen Bildschirm in 2 Abschnitte zu teilen. Es sieht wie folgt aus:2 Ansichten nebeneinander mit der gleichen Höhe
Der erste innere Aufbau hat eine Textview und ein Button. Der zweite hat eine ImageView und auch einen Button. Jetzt möchte ich die gleiche Höhe für TextView und ImageView erreichen, ohne einen festen Wert für layout_height zu setzen. Die linke Taste sollte ebenfalls mit der rechten Taste übereinstimmen.
Hier ist meine xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context="de.dk.masterfi.ActMain">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="280dp"
android:background="@drawable/border"
android:padding="10dp"
android:text="@string/welcome"/>
<Button android:id="@+id/button2" android:layout_width="match_parent"
android:layout_height="wrap_content" android:text="Favoriten"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="280dp" android:src="@drawable/training"/>
<Button android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="Hauptmenü"/>
</LinearLayout>
Wow, danke! Sehr gute Lösung. –