Buttons im + anordnen

Hi,
wie der Titel schon sagt, möchte ich die Buttons für eine Steuerung im "+" anordnen, etwa so:

Prog.png


Ich habe das zwar irgendwie hingeschummelt, jedoch sind die Buttons je nach Auflösung auf jedem Gerät verschoben. Ich habs halt so gemacht, dass es auf dem Emulator stimmt.
Weiss jemand wie man es anordnen kann, dass sie auf jedem Gerät gleich aussehen?
Hier mein aktueller Java-Code:
Java:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button
        android:id="@+id/buttonSend"
        android:layout_width="88dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="80dp"
        android:onClick="ForwardButton"
        android:text="@string/Forward" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:baselineAligned="true"
        android:orientation="horizontal" >
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="26.5dp"
            android:layout_weight="0.27"
            android:onClick="LeftButton"
            android:text="@string/Left" />
        <Button
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.27"
            android:onClick="CancelButton"
            android:text="@string/Cancel" />
        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="26.5dp"
            android:layout_weight="0.26"
            android:onClick="RightButton"
            android:text="@string/Right" />        
    </LinearLayout>
    
    <Button
        android:id="@+id/button3"
        android:layout_width="88dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="115dp"
        android:layout_marginTop="10dp"
        android:onClick="BackwardButton"
        android:text="@string/Back" />    
</LinearLayout>
 

schlingel

Gesperrter Benutzer
Mit einem RelativeLayout. Den obersten Button zentrierst du horizontal, den X-Button ordnest du unter dem obersten an und die links und rechts Button links bzw. rechts zu dem X-Button.
Den Runter-Button setzt du dann unter den X-Button.
 
Hey,
hat super geklappt. Hatte es schon mal damit versucht, allerdings habe ich immer vergessen den Relative Layout Bereich grösser zu machen. Es war immer nur ein Button im Relative Layout.
Danke
 
Ähnliche Java Themen

Ähnliche Java Themen

Neue Themen


Oben