1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2013 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 use of CustomLayout -->
18
19<!-- BEGIN_INCLUDE(Complete) -->
20<com.example.android.apis.view.CustomLayout
21        xmlns:android="http://schemas.android.com/apk/res/android"
22        xmlns:app="http://schemas.android.com/apk/res/com.example.android.apis"
23        android:layout_width="match_parent"
24        android:layout_height="match_parent">
25
26    <!-- put first view to left. -->
27    <TextView
28            android:background="@drawable/filled_box"
29            android:layout_width="wrap_content"
30            android:layout_height="wrap_content"
31            app:layout_position="left"
32            android:layout_gravity="fill_vertical|center_horizontal"
33            android:text="l1"/>
34
35    <!-- stack second view to left. -->
36    <TextView
37            android:background="@drawable/filled_box"
38            android:layout_width="wrap_content"
39            android:layout_height="wrap_content"
40            app:layout_position="left"
41            android:layout_gravity="fill_vertical|center_horizontal"
42            android:text="l2"/>
43
44    <!-- also put a view on the right. -->
45    <TextView
46            android:background="@drawable/filled_box"
47            android:layout_width="wrap_content"
48            android:layout_height="wrap_content"
49            app:layout_position="right"
50            android:layout_gravity="fill_vertical|center_horizontal"
51            android:text="r1"/>
52
53    <!-- by default views go in the middle; use fill vertical gravity -->
54    <TextView
55            android:background="@drawable/green"
56            android:layout_width="wrap_content"
57            android:layout_height="wrap_content"
58            android:layout_gravity="fill_vertical|center_horizontal"
59            android:text="fill-vert"/>
60
61    <!-- by default views go in the middle; use fill horizontal gravity -->
62    <TextView
63            android:background="@drawable/green"
64            android:layout_width="wrap_content"
65            android:layout_height="wrap_content"
66            android:layout_gravity="center_vertical|fill_horizontal"
67            android:text="fill-horiz"/>
68
69    <!-- by default views go in the middle; use top-left gravity -->
70    <TextView
71            android:background="@drawable/blue"
72            android:layout_width="wrap_content"
73            android:layout_height="wrap_content"
74            android:layout_gravity="top|left"
75            android:text="top-left"/>
76
77    <!-- by default views go in the middle; use center gravity -->
78    <TextView
79            android:background="@drawable/blue"
80            android:layout_width="wrap_content"
81            android:layout_height="wrap_content"
82            android:layout_gravity="center"
83            android:text="center"/>
84
85    <!-- by default views go in the middle; use bottom-right -->
86    <TextView
87            android:background="@drawable/blue"
88            android:layout_width="wrap_content"
89            android:layout_height="wrap_content"
90            android:layout_gravity="bottom|right"
91            android:text="bottom-right"/>
92
93</com.example.android.apis.view.CustomLayout>
94<!-- END_INCLUDE(Complete) -->
95