xref: /aosp_15_r20/cts/tests/tests/widget/res/layout/linearlayout_layout.xml (revision b7c941bb3fa97aba169d73cee0bed2de8ac964bf)
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 * Copyright (C) 2008 The Android Open Source Project.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 -->
17<ScrollView
18        xmlns:android="http://schemas.android.com/apk/res/android"
19        android:id="@+id/linearlayout_root"
20        android:fitsSystemWindows="true"
21        android:layout_width="match_parent"
22        android:layout_height="match_parent">
23    <LinearLayout
24        android:layout_width="match_parent"
25        android:layout_height="wrap_content"
26        android:orientation="vertical">
27
28        <LinearLayout
29            android:id="@+id/linear_horizontal"
30            android:layout_width="wrap_content"
31            android:layout_height="100dip"
32            android:orientation="horizontal"
33            android:background="#888">
34
35            <TextView
36                android:id="@+id/gravity_top"
37                android:layout_width="wrap_content"
38                android:layout_height="50dip"
39                android:layout_gravity="top"
40                android:background="#0F0"
41                android:text="@string/horizontal_text_1" />
42
43            <TextView
44                android:id="@+id/gravity_center_vertical"
45                android:layout_width="wrap_content"
46                android:layout_height="50dip"
47                android:layout_gravity="center_vertical"
48                android:background="#0F0"
49                android:text="@string/horizontal_text_2" />
50
51            <TextView
52                android:id="@+id/gravity_bottom"
53                android:layout_width="wrap_content"
54                android:layout_height="50dip"
55                android:layout_gravity="bottom"
56                android:background="#0F0"
57                android:text="@string/horizontal_text_3" />
58        </LinearLayout>
59
60        <LinearLayout
61            android:id="@+id/linear_vertical"
62            android:layout_width="100dip"
63            android:layout_height="wrap_content"
64            android:orientation="vertical"
65            android:background="#F00">
66
67            <TextView
68                android:id="@+id/gravity_left"
69                android:layout_width="wrap_content"
70                android:layout_height="20dip"
71                android:layout_gravity="left"
72                android:background="#0F0"
73                android:text="@string/vertical_text_1" />
74
75            <TextView
76                android:id="@+id/gravity_center_horizontal"
77                android:layout_width="wrap_content"
78                android:layout_height="20dip"
79                android:layout_gravity="center_horizontal"
80                android:background="#00F"
81                android:text="@string/vertical_text_2" />
82
83            <TextView
84                android:id="@+id/gravity_right"
85                android:layout_width="wrap_content"
86                android:layout_height="20dip"
87                android:layout_gravity="right"
88                android:background="#0F0"
89                android:text="@string/vertical_text_3" />
90        </LinearLayout>
91
92        <LinearLayout
93            android:id="@+id/linear_weightsum"
94            android:layout_width="100dip"
95            android:layout_height="100dip"
96            android:orientation="horizontal"
97            android:weightSum="1.0"
98            android:baselineAligned="false"
99            android:background="#888">
100
101            <TextView
102                android:id="@+id/weight_0_2"
103                android:layout_width="0dip"
104                android:layout_height="wrap_content"
105                android:layout_weight="0.2"
106                android:background="#00F"
107                android:text="@string/horizontal_text_1" />
108
109            <TextView
110                android:id="@+id/weight_0_5"
111                android:layout_width="0dip"
112                android:layout_height="wrap_content"
113                android:layout_weight="0.5"
114                android:background="#F00"
115                android:text="@string/horizontal_text_2" />
116
117            <TextView
118                android:id="@+id/weight_0_3"
119                android:layout_width="0dip"
120                android:layout_height="wrap_content"
121                android:layout_weight="0.3"
122                android:background="#00F"
123                android:text="@string/horizontal_text_3" />
124        </LinearLayout>
125
126        <LinearLayout
127            android:id="@+id/linear_weightsum_vertical"
128            android:layout_width="100dip"
129            android:layout_height="100dip"
130            android:orientation="vertical"
131            android:weightSum="1.0"
132            android:baselineAligned="false"
133            android:background="#888">
134
135            <TextView
136                android:id="@+id/weight_0_1"
137                android:layout_width="wrap_content"
138                android:layout_height="0dip"
139                android:layout_weight="0.1"
140                android:background="#00F"
141                android:text="@string/vertical_text_1" />
142
143            <TextView
144                android:id="@+id/weight_0_4"
145                android:layout_width="wrap_content"
146                android:layout_height="0dip"
147                android:layout_weight="0.4"
148                android:background="#F00"
149                android:text="@string/vertical_text_2" />
150
151            <TextView
152                android:id="@+id/weight_0_5"
153                android:layout_width="wrap_content"
154                android:layout_height="0dip"
155                android:layout_weight="0.5"
156                android:background="#00F"
157                android:text="@string/vertical_text_3" />
158        </LinearLayout>
159
160        <LinearLayout
161            android:id="@+id/linear_baseline_aligned_child_index"
162            android:layout_width="wrap_content"
163            android:layout_height="wrap_content"
164            android:orientation="vertical"
165            android:baselineAlignedChildIndex="1"
166            android:background="#F00">
167
168            <TextView
169                android:id="@+id/textview1"
170                android:layout_width="wrap_content"
171                android:layout_height="20dip"
172                android:layout_gravity="left"
173                android:background="#0F0"
174                android:text="@string/vertical_text_1" />
175
176            <TextView
177                android:id="@+id/textview2"
178                android:layout_width="wrap_content"
179                android:layout_height="20dip"
180                android:layout_gravity="center_horizontal"
181                android:background="#00F"
182                android:text="@string/vertical_text_2" />
183
184            <TextView
185                android:id="@+id/textview3"
186                android:layout_width="wrap_content"
187                android:layout_height="20dip"
188                android:layout_gravity="right"
189                android:background="#0F0"
190                android:text="@string/vertical_text_3" />
191        </LinearLayout>
192
193        <LinearLayout
194            android:id="@+id/linear_vertical_with_divider"
195            android:layout_width="100px"
196            android:layout_height="100px"
197            android:orientation="vertical"
198            android:background="#FF0"
199            android:showDividers="middle"
200            android:divider="@drawable/linear_layout_divider_red"
201            android:dividerPadding="@dimen/linear_layout_divider_padding">
202
203            <View
204                android:id="@+id/child1"
205                android:layout_width="match_parent"
206                android:layout_height="0dip"
207                android:layout_weight="0.5"
208                android:background="#00F" />
209
210            <View
211                android:id="@+id/child2"
212                android:layout_width="match_parent"
213                android:layout_height="0dip"
214                android:layout_weight="0.5"
215                android:background="#0F0" />
216
217        </LinearLayout>
218
219        <LinearLayout
220            android:id="@+id/linear_horizontal_with_divider"
221            android:layout_width="100px"
222            android:layout_height="100px"
223            android:orientation="horizontal"
224            android:background="#FF0"
225            android:showDividers="middle"
226            android:divider="@drawable/linear_layout_divider_red"
227            android:dividerPadding="@dimen/linear_layout_divider_padding">
228
229            <View
230                android:id="@+id/child1"
231                android:layout_width="0dip"
232                android:layout_height="match_parent"
233                android:layout_weight="0.5"
234                android:background="#00F" />
235
236            <View
237                android:id="@+id/child2"
238                android:layout_width="0dip"
239                android:layout_height="match_parent"
240                android:layout_weight="0.5"
241                android:background="#0F0" />
242
243        </LinearLayout>
244
245        <LinearLayout
246            android:id="@+id/linear_empty"
247            android:layout_width="100px"
248            android:layout_height="100px" />
249
250        <view
251            class="android.widget.cts.LinearLayoutTest$MockLinearLayout"
252            android:id="@+id/linear_custom"
253            android:layout_width="100px"
254            android:layout_height="100px" />
255    </LinearLayout>
256</ScrollView>
257