Ich habe ein Layout wie im Taschenrechner, 4 Tasten in jeder Zeile, mit etwa 5 Zeilen. Ich habe diese Zeilen mit LinearLayout
erstellt. Ich hatte es geschafft, die Breite jeder Reihe vollständig zu füllen, indem ich android:layout_weight="1"
in jeder Taste in LinearLayout
verwendete. Aber ich weiß nicht, wie man den vertikalen Raum auf diese Weise füllt. Nach fünf Reihen an der Unterseite gibt es Platz für normale XDPI Bildschirme verbleibenden (Nexus 4)Wie gleichmäßig Schaltflächen und Layouts vertikal in Android?
<LinearLayout
android:id="@+id/first_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/entry">
<Button
android:id="@+id/seven"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="7"
android:textColor="@color/Blue_ICS"
android:textSize="@dimen/button_text_size"
/>
<Button
android:id="@+id/eight"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="8"
android:textColor="@color/Blue_ICS"
android:textSize="@dimen/button_text_size"/>
<Button
android:id="@+id/nine"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="9"
android:textColor="@color/Blue_ICS"
android:textSize="@dimen/button_text_size"/>
<Button
android:id="@+id/plus"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="+"
android:textColor="@color/Blue_ICS"
android:textSize="@dimen/button_text_size"/>
</LinearLayout>
Das Layout ist zu lang ich hier so teile Code von nur ersten Zeilen sind restliche Zeilen zu gleich.
Möchten Sie Ihre Zeilen mit gleicher Höhe füllen? –
Haben Sie versucht, das 'LinearLayout' Höhenattribut zu ändern ?:' android: layout_height = "match_parent" ' –
überprüfen Sie [diesen Link] (http://stackoverflow.com/a/8105131/2345913) – CRUSADER