@@ -41,9 +41,9 @@ specific language governing permissions and limitations under the License.
41
41
app : cardBackgroundColor =" @android:color/white"
42
42
app : cardUseCompatPadding =" true" >
43
43
44
- <RelativeLayout
44
+ <androidx .constraintlayout.widget.ConstraintLayout
45
45
android : layout_width =" match_parent"
46
- android : layout_height =" match_parent "
46
+ android : layout_height =" wrap_content "
47
47
android : padding =" 16dp" >
48
48
49
49
<TextView
@@ -52,69 +52,76 @@ specific language governing permissions and limitations under the License.
52
52
android : layout_height =" wrap_content"
53
53
android : text =" @string/heading_add_numbers"
54
54
android : textSize =" 20sp"
55
- android : textStyle =" bold" />
55
+ android : textStyle =" bold"
56
+ app : layout_constraintStart_toStartOf =" parent"
57
+ app : layout_constraintTop_toTopOf =" parent" />
56
58
59
+ <EditText
60
+ android : id =" @+id/fieldFirstNumber"
61
+ android : layout_width =" 50dp"
62
+ android : layout_height =" wrap_content"
63
+ android : gravity =" center"
64
+ android : inputType =" number"
65
+ app : layout_constraintStart_toStartOf =" @+id/header_add_numbers"
66
+ app : layout_constraintTop_toBottomOf =" @+id/header_add_numbers"
67
+ tools : text =" 1" />
57
68
58
- <LinearLayout
59
- android : id =" @+id/form_add_numbers"
60
- android : layout_width =" match_parent"
69
+ <TextView
70
+ android : id =" @+id/labelPlus"
71
+ android : layout_width =" wrap_content"
72
+ android : layout_height =" wrap_content"
73
+ android : text =" @string/plus"
74
+ android : textSize =" 14sp"
75
+ android : textStyle =" bold"
76
+ app : layout_constraintBottom_toBottomOf =" @+id/fieldFirstNumber"
77
+ app : layout_constraintStart_toEndOf =" @+id/fieldFirstNumber"
78
+ app : layout_constraintTop_toTopOf =" @+id/fieldFirstNumber" />
79
+
80
+ <EditText
81
+ android : id =" @+id/fieldSecondNumber"
82
+ android : layout_width =" 50dp"
61
83
android : layout_height =" wrap_content"
62
- android : layout_below =" @+id/header_add_numbers"
63
- android : orientation =" horizontal" >
64
-
65
- <EditText
66
- android : id =" @+id/fieldFirstNumber"
67
- android : layout_width =" 50dp"
68
- android : layout_height =" wrap_content"
69
- android : gravity =" center"
70
- android : inputType =" number"
71
- tools : text =" 1" />
72
-
73
- <TextView
74
- android : layout_width =" wrap_content"
75
- android : layout_height =" wrap_content"
76
- android : text =" @string/plus"
77
- android : textSize =" 14sp"
78
- android : textStyle =" bold" />
79
-
80
- <EditText
81
- android : id =" @+id/fieldSecondNumber"
82
- android : layout_width =" 50dp"
83
- android : layout_height =" wrap_content"
84
- android : gravity =" center"
85
- android : inputType =" number"
86
- tools : text =" 1" />
87
-
88
- <TextView
89
- android : layout_width =" wrap_content"
90
- android : layout_height =" wrap_content"
91
- android : text =" @string/equals"
92
- android : textSize =" 14sp"
93
- android : textStyle =" bold" />
94
-
95
- <EditText
96
- android : id =" @+id/fieldAddResult"
97
- android : layout_width =" 50dp"
98
- android : layout_height =" wrap_content"
99
- android : enabled =" false"
100
- android : gravity =" center"
101
- android : inputType =" number"
102
- tools : text =" 2" />
103
-
104
- </LinearLayout >
84
+ android : gravity =" center"
85
+ android : inputType =" number"
86
+ tools : text =" 1"
87
+ app : layout_constraintBottom_toBottomOf =" @+id/labelPlus"
88
+ app : layout_constraintStart_toEndOf =" @+id/labelPlus"
89
+ app : layout_constraintTop_toTopOf =" @+id/labelPlus" />
90
+
91
+ <TextView
92
+ android : id =" @+id/labelEquals"
93
+ android : layout_width =" wrap_content"
94
+ android : layout_height =" wrap_content"
95
+ android : text =" @string/equals"
96
+ android : textSize =" 14sp"
97
+ android : textStyle =" bold"
98
+ app : layout_constraintBottom_toBottomOf =" @+id/fieldSecondNumber"
99
+ app : layout_constraintStart_toEndOf =" @+id/fieldSecondNumber"
100
+ app : layout_constraintTop_toTopOf =" @+id/fieldSecondNumber" />
101
+
102
+ <EditText
103
+ android : id =" @+id/fieldAddResult"
104
+ android : layout_width =" 50dp"
105
+ android : layout_height =" wrap_content"
106
+ android : enabled =" false"
107
+ android : gravity =" center"
108
+ android : inputType =" number"
109
+ tools : text =" 2"
110
+ app : layout_constraintBottom_toBottomOf =" @+id/labelEquals"
111
+ app : layout_constraintStart_toEndOf =" @+id/labelEquals"
112
+ app : layout_constraintTop_toTopOf =" @+id/labelEquals" />
113
+
105
114
106
115
<com .google.android.material.button.MaterialButton
107
116
android : id =" @+id/buttonCalculate"
108
117
style =" @style/Widget.MaterialComponents.Button.TextButton"
109
118
android : layout_width =" wrap_content"
110
119
android : layout_height =" wrap_content"
111
- android : layout_alignParentEnd =" true"
112
- android : layout_alignParentRight =" true"
113
- android : layout_below =" @+id/form_add_numbers"
114
- android : text =" @string/calculate" />
120
+ android : text =" @string/calculate"
121
+ app : layout_constraintEnd_toEndOf =" parent"
122
+ app : layout_constraintTop_toBottomOf =" @+id/fieldFirstNumber" />
115
123
116
-
117
- </RelativeLayout >
124
+ </androidx .constraintlayout.widget.ConstraintLayout>
118
125
119
126
</com .google.android.material.card.MaterialCardView>
120
127
@@ -125,9 +132,9 @@ specific language governing permissions and limitations under the License.
125
132
app : cardBackgroundColor =" @android:color/white"
126
133
app : cardUseCompatPadding =" true" >
127
134
128
- <RelativeLayout
135
+ <androidx .constraintlayout.widget.ConstraintLayout
129
136
android : layout_width =" match_parent"
130
- android : layout_height =" match_parent "
137
+ android : layout_height =" wrap_content "
131
138
android : padding =" 16dp" >
132
139
133
140
<TextView
@@ -136,54 +143,55 @@ specific language governing permissions and limitations under the License.
136
143
android : layout_height =" wrap_content"
137
144
android : text =" @string/heading_add_message"
138
145
android : textSize =" 20sp"
139
- android : textStyle =" bold" />
140
-
146
+ android : textStyle =" bold"
147
+ app : layout_constraintStart_toStartOf =" parent"
148
+ app : layout_constraintTop_toTopOf =" parent" />
141
149
142
- <LinearLayout
143
- android : id =" @+id/form_add_message "
150
+ <EditText
151
+ android : id =" @+id/fieldMessageInput "
144
152
android : layout_width =" match_parent"
145
153
android : layout_height =" wrap_content"
146
- android : layout_below =" @+id/header_add_message"
147
- android : orientation =" vertical" >
148
-
149
- <EditText
150
- android : id =" @+id/fieldMessageInput"
151
- android : layout_width =" match_parent"
152
- android : layout_height =" wrap_content"
153
- android : hint =" @string/input"
154
- tools : text =" some bad message" />
155
-
156
- <EditText
157
- android : id =" @+id/fieldMessageOutput"
158
- android : layout_width =" match_parent"
159
- android : layout_height =" wrap_content"
160
- android : enabled =" false"
161
- android : hint =" @string/output"
162
- tools : text =" some clean message" />
163
-
164
- </LinearLayout >
154
+ android : hint =" @string/input"
155
+ android : inputType =" text"
156
+ app : layout_constraintEnd_toEndOf =" parent"
157
+ app : layout_constraintStart_toStartOf =" parent"
158
+ app : layout_constraintTop_toBottomOf =" @+id/header_add_message"
159
+ tools : text =" some bad message" />
160
+
161
+ <EditText
162
+ android : id =" @+id/fieldMessageOutput"
163
+ android : layout_width =" match_parent"
164
+ android : layout_height =" wrap_content"
165
+ android : enabled =" false"
166
+ android : hint =" @string/output"
167
+ android : inputType =" text"
168
+ app : layout_constraintEnd_toEndOf =" @+id/fieldMessageInput"
169
+ app : layout_constraintStart_toStartOf =" @+id/fieldMessageInput"
170
+ app : layout_constraintTop_toBottomOf =" @+id/fieldMessageInput"
171
+ tools : text =" some clean message" />
165
172
166
173
<com .google.android.material.button.MaterialButton
167
174
android : id =" @+id/buttonSignIn"
168
175
style =" @style/Widget.MaterialComponents.Button.TextButton"
169
176
android : layout_width =" wrap_content"
170
177
android : layout_height =" wrap_content"
171
178
android : layout_alignTop =" @+id/buttonAddMessage"
172
- android : layout_toLeftOf =" @+id/buttonAddMessage"
173
179
android : layout_toStartOf =" @+id/buttonAddMessage"
174
- android : text =" @string/sign_in" />
180
+ android : layout_toLeftOf =" @+id/buttonAddMessage"
181
+ android : text =" @string/sign_in"
182
+ app : layout_constraintEnd_toStartOf =" @+id/buttonAddMessage"
183
+ app : layout_constraintTop_toBottomOf =" @+id/fieldMessageOutput" />
175
184
176
185
<com .google.android.material.button.MaterialButton
177
186
android : id =" @+id/buttonAddMessage"
178
187
style =" @style/Widget.MaterialComponents.Button.TextButton"
179
188
android : layout_width =" wrap_content"
180
189
android : layout_height =" wrap_content"
181
- android : layout_alignParentEnd =" true"
182
- android : layout_alignParentRight =" true"
183
- android : layout_below =" @+id/form_add_message"
184
- android : text =" @string/add_message" />
190
+ android : text =" @string/add_message"
191
+ app : layout_constraintEnd_toEndOf =" @+id/fieldMessageOutput"
192
+ app : layout_constraintTop_toBottomOf =" @+id/fieldMessageOutput" />
185
193
186
- </RelativeLayout >
194
+ </androidx .constraintlayout.widget.ConstraintLayout >
187
195
188
196
</com .google.android.material.card.MaterialCardView>
189
197
0 commit comments