1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2007 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16
17<!-- Demonstrates using a relative layout to create a form -->
18
19<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
20    android:layout_width="match_parent"
21    android:layout_height="wrap_content"
22    android:background="@drawable/blue"
23    android:padding="10dip">
24
25    <!--
26        TextView goes at the top left by default .
27    -->
28    <TextView
29        android:id="@+id/label"
30        android:layout_width="match_parent"
31        android:layout_height="wrap_content"
32        android:text="@string/relative_layout_2_instructions"/>
33
34    <!--
35        Put the EditText field under the TextView
36    -->
37    <EditText
38        android:id="@+id/entry"
39        android:layout_width="match_parent"
40        android:layout_height="wrap_content"
41        android:layout_below="@id/label"/>
42
43    <!--
44        The OK button goes below the EditText field.
45        It is also aligned to the right edge of the parent
46        (respecting the parent's padding).
47        The OK button comes first so the Cancel button
48        can be specified relative to the OK button.
49    -->
50    <Button
51        android:id="@+id/ok"
52        android:layout_width="wrap_content"
53        android:layout_height="wrap_content"
54        android:layout_below="@id/entry"
55        android:layout_alignParentRight="true"
56        android:layout_marginLeft="10dip"
57        android:text="@string/relative_layout_2_ok" />
58
59    <!--
60        The Cancel button is aligned with the top of
61        the OK button and positioned to the left of it.
62        Since the OK button has a left margin of 10, there
63        is some space between the two buttons.
64    -->
65    <Button
66        android:layout_width="wrap_content"
67        android:layout_height="wrap_content"
68        android:layout_toLeftOf="@id/ok"
69        android:layout_alignTop="@id/ok"
70        android:text="@string/relative_layout_2_cancel" />
71
72</RelativeLayout>
73
74