Anordnen von Schaltflächen in Rautenform in android xml
Ich möchte einen Bildschirm mit vier Knöpfen in Form eines Diamanten (wie ein Quadrat, das um 45 Grad zur Seite gedreht ist) erstellen und alle vier zu einem größeren Diamanten angeordnet.
Ich habe hier auf SO herumgesucht und es geschafft, diese XML-Datei zu erstellen, die Hinweise darauf gibt, was ich erreichen möchte:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/White"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/scoreCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge">
</TextView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_weight="1.0" >
<Button
android:id="@+id/topLeftOuter"
android:layout_centerInParent="true"
android:layout_width="60dp"
android:layout_height = "60dp"
android:background="@color/Blue"
android:clickable="true"
android:visibility="visible"
android:adjustViewBounds="true"
android:rotation="45" >
</Button>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:clickable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_weight="1.0" >
<Button
android:id="@+id/bottomLeftOuter"
android:layout_centerInParent="true"
android:layout_width="60dp"
android:layout_height = "60dp"
android:background="@color/Yellow"
android:clickable="true"
android:visibility="visible"
android:adjustViewBounds="true"
android:rotation="45" >
</Button>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_weight="1.0" >
<Button
android:id="@+id/bottomRightOuter"
android:layout_centerInParent="true"
android:layout_width="60dp"
android:layout_height = "60dp"
android:background="@color/Red"
android:clickable="true"
android:visibility="visible"
android:adjustViewBounds="true"
android:rotation="45" >
</Button>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:clickable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_weight="1.0" >
<Button
android:id="@+id/topRightOuter"
android:layout_centerInParent="true"
android:layout_width="60dp"
android:layout_height = "60dp"
android:background="@color/Chartreuse"
android:clickable="true"
android:visibility="visible"
android:adjustViewBounds="true"
android:rotation="45" >
</Button>
</RelativeLayout>
</LinearLayout>
Dies ist das Ergebnis:
Aber ich möchte etwas mehr in dieser Richtung:
Wie soll ich dorthin gehen?