Verschachtelte vertical layout horizontales layout
Ich bin erstellen einer android-app und ich möchte ein layout erstellen, dass sich zwei Tasten nebeneinander und drei buttons darunter. Ein Beispiel, was ich versuche zu tun, kann hier gefunden werden:
http://mycolorscreen.com/2014/11/29/flatdrop-zw-skin/
Ich bin kämpfen, um die zwei Tasten nebeneinander in einem horizontalen linearen Aufbau, und auch die drei Tasten in einer vertikalen linearen layout. Seit dem ersten linearen layout ist horizontal, es wird meine buttons horizontal als auch. Mein code ist wie folgt:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:weightSum="1">
<TextView
android:layout_width="164dp"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView2"
android:layout_gravity="left"
android:layout_weight="0.1" />
<TextView
android:layout_width="174dp"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView"
android:layout_gravity="right"
android:layout_weight="0.1" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
style="@style/AppTheme"
android:longClickable="false"
android:weightSum="1">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btnFitnessGoalsDefaultString"
android:textColor="#FFFFFF"
android:id="@+id/btnFitnessGoals"
android:background="@drawable/buttondefault"
android:layout_marginBottom="10dp"
android:layout_weight="0.10"
android:layout_gravity="top" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="@string/btnNutritionGoalsDefaultString"
android:textColor="#FFFFFF"
android:id="@+id/btnNutritionGoals"
android:background="@drawable/buttondefault"
android:layout_weight="0.10" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/btnBonusEventsDefaultString"
android:textColor="#FFFFFF"
android:id="@+id/btnBonusEvents"
android:background="@drawable/buttondefault"
android:layout_weight="0.10" />
</LinearLayout>
</LinearLayout>
Du musst angemeldet sein, um einen Kommentar abzugeben.
Verwenden Sie so etwas wie dieses:
Müssen Sie etwas tun, wie dieses
Etwas einfacher:
Diesem layout, funktioniert mit allen Geräte-Bildschirm. versuchen Sie mit ihm .