Ich entwickle eine Android-Anwendung.Richten Sie Tasten in einem TableRow
Ich habe diese:
<?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="200px"
android:orientation="vertical">
<TextView
android:id="@+id/gameTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="left"
android:layout_margin="5px"
android:text="aaaaa"/>
<TextView
android:id="@+id/gameDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="left"
android:layout_margin="5px"
android:typeface="sans"
android:textSize="16sp"
android:textStyle="bold"
android:text="dddddd"/>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ButtonsTable"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:text="@string/yes"
android:id="@+id/playGame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:text="@string/no"
android:id="@+id/noPlayGame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
</LinearLayout>
Ich mag Playgame-Taste auf der linken Seite des Zentrums, und noPlayGame Taste auf der rechten Seite von der Mitte setzen.
Jetzt erscheinen beide auf der linken Seite des TableRow ausgerichtet.
Wie kann ich das tun?
Vielen Dank.
EDIT: Ich habe das komplette Layout und die von Ashay vorgeschlagenen Änderungen hinzugefügt.
2. EDIT:
DIE LÖSUNG
ich TableLayout
hinzugefügt haben die folgenden: android:stretchColumns="0,1"
. Jetzt sind die Buttons in der Mitte ausgerichtet, aber sie füllen ihre Entire Spalte !!!
Wahrscheinlich lohnt es sich, eine eigene Antwort zu posten und sie als beantwortet zu markieren, damit sie nicht in der unbeantworteten Fragenliste auftaucht. –
Ich mag es nicht, meine eigenen Fragen zu beantworten. – VansFannel