Ich habe folgendes Layout
Ich möchte, dass Knöpfe ganz unten sind - alle 3Die Steuerelemente sollten unten ausgerichtet sein. (Jetzt sind sie an der Spitze.) Laut Dokumentation (so lange ich es verstehe), sollte Schwerkraft oder Layout_gravity das Ziel sein, aber sie funktionieren in diesem Fall nicht?
Folgendes ist der Code. Bitte, was ist das Problem?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_gravity="bottom">
<Button
android:id="@+id/ButtonLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="bottom"
android:layout_weight="1"
android:text="Show"/>
<TextView
android:id="@+id/Help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="10"
android:gravity="center"
android:text="Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong text !"/>
<Button
android:id="@+id/ButtonRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:text="Show"/>
</LinearLayout>
Antworten:
2 für die Antwort № 1Löschen android:gravity="bottom"
von Eltern LinearLayout.
1 für die Antwort № 2
Kopiere und füge das ein
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom">
<Button
android:id="@+id/ButtonLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:text="Show"/>
<TextView
android:id="@+id/Help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="10"
android:gravity="center"
android:text="Very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong text !"/>
<Button
android:id="@+id/ButtonRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:text="Show"/>