Ich bin unerfahren mit Android und arbeitet an einem Layout, das einen unteren Bereich mit 3 Tasten haben soll angezeigt auf diese Weise:Ausstattung - eine Taste oben auf zwei Tasten
ich es geschafft, fast bekommen es so, außer dass je nach Bildschirm die unteren Tasten sich gegenseitig überlappen oder zu weit weg sind. Die Knöpfe sollen perfekt unter dem "APPLY" Knopf ausgerichtet sein, aber ich kann nicht scheinen, es richtig zu machen.
Hier ist mein aktueller Code:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="20dp">
<RelativeLayout
android:id="@+id/relapply"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<Button
android:id="@+id/apply"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_buttons_carousel"
android:text="@string/apply_button"
android:textSize="15sp"
android:textColor="@android:color/white"
android:width="320dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_below="@id/relapply">
<Button
android:id="@+id/discard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_buttons_carousel"
android:text="@string/discard_button"
android:textSize="15sp"
android:textColor="@android:color/white"
android:layout_marginStart="30dp"
android:width="154dp"
android:layout_alignParentStart="true"/>
<RelativeLayout
android:layout_width="12dp"
android:layout_height="30dp"
android:layout_toLeftOf="@id/save">
</RelativeLayout>
<Button
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ripple_buttons_carousel"
android:text="@string/save_button"
android:textSize="15sp"
android:textColor="@android:color/white"
android:layout_marginEnd="30dp"
android:width="154dp"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
Dies ist mein Code für das Layout, in dem die Tasten in und dann alles in einer linearen Layout XML-Testdatei ich gemacht.. Irgendwelche Tipps, wie man das verbessert?
Danke!
Das hat den Trick, danke! Ich wusste, dass es Sinn machen würde, mit Gewichten hier zu arbeiten, aber ich hatte nicht die Chance, es auszuprobieren. – Jaqualembo