Ich habe große Schwierigkeiten mit dem Versuch, ein einfaches Layout mit zwei TextView: s unter einander auf der linken Seite und zwei korrespondierenden TimePicker: s unter einander auf der rechten Seite zu erstellen. Aber egal welche Ansicht ich verwende oder welche Attribute ich aussuche, die relevant erscheinen, ich bekomme nicht das gewünschte Ergebnis. Hier ist meine aktuelle Versuch ist:Android: Wie man Layouts versteht?
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1"
>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
>
<TextView
android:layout_column="1"
android:id="@+id/text_start_time"
android:text="@string/start_time"
android:gravity="center_horizontal"
/>
<TimePicker
android:id="@+id/time_picker_start"
android:timePickerMode="spinner"
android:layout_marginTop="-25dp"
android:layout_marginBottom="-25dp"
android:layout_gravity="center"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
>
<TextView
android:layout_column="1"
android:id="@+id/text_end_time"
android:text="@string/end_time"
android:layout_gravity="center_horizontal"
/>
<TimePicker
android:id="@+id/time_picker_end"
android:timePickerMode="spinner"
android:layout_marginTop="-25dp"
android:layout_marginBottom="-25dp"
/>
</TableRow>
<TableRow>
<Button
android:layout_column="2"
android:layout_width="match_parent"
android:text="@string/button_calculate"
android:gravity="center"
android:onClick="calculateWorkingTime"
/>
</TableRow>
</TableLayout>
Dies ergibt die folgende Ausgabe
Wie Sie sehen können "Start" ist nicht einmal gezeigt! Ich möchte "Start" mit der vertikalen Mitte des TimePicker Spinner ausrichten. Wie geht das?