1+ <?xml version =" 1.0" encoding =" utf-8" ?><!--
2+ ~ Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
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+
18+ <LinearLayout xmlns : android =" http://schemas.android.com/apk/res/android"
19+ xmlns : app =" http://schemas.android.com/apk/res-auto"
20+ android : layout_width =" match_parent"
21+ android : layout_height =" match_parent"
22+ android : orientation =" vertical" >
23+
24+ <androidx .constraintlayout.widget.ConstraintLayout
25+ android : layout_width =" match_parent"
26+ android : layout_height =" match_parent" >
27+
28+ <TextView
29+ android : id =" @+id/text4"
30+ android : layout_width =" wrap_content"
31+ android : layout_height =" wrap_content"
32+ android : background =" @color/app_color_theme_1"
33+ android : text =" 顶部水平居中"
34+ android : textColor =" @android:color/white"
35+ app : layout_constraintEnd_toEndOf =" parent"
36+ app : layout_constraintStart_toStartOf =" parent"
37+ app : layout_constraintTop_toTopOf =" parent" />
38+
39+ <TextView
40+ android : id =" @+id/text5"
41+ android : layout_width =" wrap_content"
42+ android : layout_height =" wrap_content"
43+ android : background =" @color/app_color_theme_1"
44+ android : text =" 底部水平居中"
45+ android : textColor =" @android:color/white"
46+ app : layout_constraintBottom_toBottomOf =" parent"
47+ app : layout_constraintEnd_toEndOf =" parent"
48+ app : layout_constraintStart_toStartOf =" parent" />
49+
50+ <TextView
51+ android : layout_width =" wrap_content"
52+ android : layout_height =" wrap_content"
53+ android : layout_marginTop =" @dimen/spacing_16"
54+ android : background =" @color/app_color_theme_5"
55+ android : text =" 水平方向1/3处"
56+ android : textColor =" @android:color/white"
57+ app : layout_constraintEnd_toEndOf =" parent"
58+ app : layout_constraintHorizontal_bias =" 0.33"
59+ app : layout_constraintStart_toStartOf =" parent"
60+ app : layout_constraintTop_toBottomOf =" @id/text4" />
61+
62+ <TextView
63+ android : layout_width =" wrap_content"
64+ android : layout_height =" wrap_content"
65+ android : background =" @color/app_color_theme_2"
66+ android : text =" 左端垂直居中"
67+ android : textColor =" @android:color/white"
68+ app : layout_constraintBottom_toBottomOf =" parent"
69+ app : layout_constraintStart_toStartOf =" parent"
70+ app : layout_constraintTop_toTopOf =" parent" />
71+
72+ <TextView
73+ android : layout_width =" wrap_content"
74+ android : layout_height =" wrap_content"
75+ android : background =" @color/app_color_theme_2"
76+ android : text =" 右端垂直居中"
77+ android : textColor =" @android:color/white"
78+ app : layout_constraintBottom_toBottomOf =" parent"
79+ app : layout_constraintEnd_toEndOf =" parent"
80+ app : layout_constraintTop_toTopOf =" parent" />
81+
82+ <TextView
83+ android : layout_width =" wrap_content"
84+ android : layout_height =" wrap_content"
85+ android : background =" @color/app_color_theme_5"
86+ android : text =" 垂直方向1/3处"
87+ android : textColor =" @android:color/white"
88+ app : layout_constraintBottom_toBottomOf =" parent"
89+ app : layout_constraintStart_toStartOf =" parent"
90+ app : layout_constraintTop_toTopOf =" parent"
91+ app : layout_constraintVertical_bias =" 0.33" />
92+
93+ <TextView
94+ android : id =" @+id/text1"
95+ android : layout_width =" wrap_content"
96+ android : layout_height =" wrap_content"
97+ android : background =" @color/app_color_theme_3"
98+ android : text =" text1:全局居中"
99+ android : textColor =" @android:color/white"
100+ app : layout_constraintBottom_toBottomOf =" parent"
101+ app : layout_constraintEnd_toEndOf =" parent"
102+ app : layout_constraintStart_toStartOf =" parent"
103+ app : layout_constraintTop_toTopOf =" parent" />
104+
105+ <TextView
106+ android : id =" @+id/text2"
107+ android : layout_width =" wrap_content"
108+ android : layout_height =" wrap_content"
109+ android : layout_marginBottom =" @dimen/spacing_16"
110+ android : background =" @color/app_color_theme_4"
111+ android : text =" text2:位于text1上,右端对齐"
112+ android : textColor =" @android:color/white"
113+ app : layout_constraintBottom_toTopOf =" @id/text1"
114+ app : layout_constraintEnd_toEndOf =" @id/text1" />
115+
116+ <TextView
117+ android : id =" @+id/text3"
118+ android : layout_width =" wrap_content"
119+ android : layout_height =" wrap_content"
120+ android : layout_marginTop =" @dimen/spacing_16"
121+ android : background =" @color/app_color_theme_4"
122+ android : text =" text3:位于text1下,左端对齐"
123+ android : textColor =" @android:color/white"
124+ app : layout_constraintStart_toStartOf =" @id/text1"
125+ app : layout_constraintTop_toBottomOf =" @id/text1" />
126+
127+
128+ <TextView
129+ android : layout_width =" wrap_content"
130+ android : layout_height =" wrap_content"
131+ android : background =" @color/app_color_theme_8"
132+ android : text =" 位于text1 225°,150dp"
133+ android : textColor =" @android:color/white"
134+ app : layout_constraintCircle =" @+id/text1"
135+ app : layout_constraintCircleAngle =" 225"
136+ app : layout_constraintCircleRadius =" 150dp"
137+ app : layout_constraintStart_toStartOf =" parent"
138+ app : layout_constraintTop_toTopOf =" parent" />
139+
140+ <TextView
141+ android : layout_width =" wrap_content"
142+ android : layout_height =" wrap_content"
143+ android : background =" @color/app_color_theme_8"
144+ android : text =" 位于text1 135°,130dp"
145+ android : textColor =" @android:color/white"
146+ app : layout_constraintCircle =" @+id/text1"
147+ app : layout_constraintCircleAngle =" 135"
148+ app : layout_constraintCircleRadius =" 130dp"
149+ app : layout_constraintStart_toStartOf =" parent"
150+ app : layout_constraintTop_toTopOf =" parent" />
151+
152+ <TextView
153+ android : id =" @+id/text6"
154+ android : layout_width =" wrap_content"
155+ android : layout_height =" wrap_content"
156+ android : layout_marginBottom =" @dimen/spacing_16"
157+ android : background =" @color/app_color_theme_6"
158+ android : text =" 文字对齐目标"
159+ android : textColor =" @android:color/white"
160+ android : textSize =" 30sp"
161+ app : layout_constraintBottom_toTopOf =" @id/text5"
162+ app : layout_constraintEnd_toEndOf =" parent"
163+ app : layout_constraintStart_toStartOf =" parent" />
164+
165+ <TextView
166+ android : layout_width =" wrap_content"
167+ android : layout_height =" wrap_content"
168+ android : layout_marginBottom =" @dimen/spacing_16"
169+ android : background =" @color/app_color_theme_7"
170+ android : text =" 基线对齐"
171+ android : textColor =" @android:color/white"
172+ app : layout_constraintBaseline_toBaselineOf =" @id/text6"
173+ app : layout_constraintBottom_toTopOf =" @id/text5"
174+ app : layout_constraintEnd_toStartOf =" @id/text6" />
175+
176+ <TextView
177+ android : layout_width =" wrap_content"
178+ android : layout_height =" wrap_content"
179+ android : layout_marginBottom =" @dimen/spacing_16"
180+ android : background =" @color/app_color_theme_7"
181+ android : text =" 基线不对齐"
182+ android : textColor =" @android:color/white"
183+ app : layout_constraintBottom_toTopOf =" @id/text5"
184+ app : layout_constraintStart_toEndOf =" @id/text6" />
185+
186+ </androidx .constraintlayout.widget.ConstraintLayout>
187+
188+ </LinearLayout >
0 commit comments