1
00:00:00,420 --> 00:00:06,780
Hire everyone in this tutorial I want to talk to you about that relationship between lay out wait and

2
00:00:06,780 --> 00:00:07,800
lay out with.

3
00:00:08,070 --> 00:00:13,110
So let's create a new and great studio project and here for the application and just type in here lay

4
00:00:13,110 --> 00:00:23,480
out wait where it says lay out what you can specify the company domain package name and the project

5
00:00:23,480 --> 00:00:24,740
location here.

6
00:00:24,740 --> 00:00:26,390
So just click on next.

7
00:00:26,390 --> 00:00:34,190
So here choose a 16 Android 4.1 jellybean as the minimum SDK for phone and tablet and then click Next

8
00:00:35,250 --> 00:00:40,350
choose MTI activity next and here just leave things as default here.

9
00:00:40,400 --> 00:00:41,450
Just click on finish.

10
00:00:41,450 --> 00:00:45,240
So now that the project is created lets actually close this window here.

11
00:00:45,430 --> 00:00:47,650
Let's go to the activity under limited exemption.

12
00:00:47,660 --> 00:00:50,630
So let's start with Twitter on this topic in order to make this area wider.

13
00:00:50,840 --> 00:00:56,770
So as you can see we have the constraint lay out as the default layout of when we actually create our

14
00:00:56,780 --> 00:00:57,910
Android application.

15
00:00:58,160 --> 00:01:04,610
So I don't want this constraint play out because all you want to use the lay out weight here and the

16
00:01:04,610 --> 00:01:11,240
lay out weight is actually only possible in say the linear layout not constrained to lay out or relatively

17
00:01:11,240 --> 00:01:11,650
out.

18
00:01:11,840 --> 00:01:18,260
So let me repeat again we can only use the lay out weight inside the linearly out.

19
00:01:18,530 --> 00:01:23,750
So here just click on inside this componentry section just click on this constraint to lay out and that

20
00:01:23,750 --> 00:01:25,610
person delete you on your keyboard.

21
00:01:25,610 --> 00:01:27,190
So as you can see we try not delete it.

22
00:01:27,290 --> 00:01:31,130
So let's actually click on this text tap it at the bottom.

23
00:01:31,130 --> 00:01:35,040
And here we can just select all these codes here.

24
00:01:35,120 --> 00:01:40,850
Except this line of code that says XML version here in code in UTF 8 just select all these codes and

25
00:01:40,840 --> 00:01:42,400
then personally reach on your keyboard.

26
00:01:42,680 --> 00:01:44,210
And if I go to the Design tab.

27
00:01:44,300 --> 00:01:48,530
Now let's actually write a linearly out here.

28
00:01:48,650 --> 00:01:54,760
So instead is palette section just click on layouts and here let's select this one linearly out.

29
00:01:54,770 --> 00:01:58,280
We're C-card here to select it and put it here.

30
00:01:58,310 --> 00:02:02,410
Inside are actually the screen so we cannot do it right.

31
00:02:02,540 --> 00:02:08,660
So let's go to the next step here and let's actually open a tag and just type in here linearly out.

32
00:02:08,930 --> 00:02:12,040
And then here just put an end in take here.

33
00:02:12,230 --> 00:02:17,660
So let's actually create some space here and now we need to actually provide some attributes for our

34
00:02:17,790 --> 00:02:18,580
linearly out.

35
00:02:18,590 --> 00:02:25,920
So first we need to specify the layout height so the layout height is going to be actually match parent.

36
00:02:25,940 --> 00:02:32,670
So just typing here much underline parent and then we need to specify that lay out.

37
00:02:32,700 --> 00:02:37,240
We actually lay out other line.

38
00:02:37,430 --> 00:02:44,600
So for the lay out 5th again match parent and then we need to specify the orientation so that orientation

39
00:02:44,600 --> 00:02:45,880
is going to be worth the cost.

40
00:02:46,010 --> 00:02:47,010
So that's it.

41
00:02:47,110 --> 00:02:54,060
And let's click on the preview here on the right sidebar here so you can see that we have our Linnea

42
00:02:54,070 --> 00:02:54,620
lay out here.

43
00:02:54,620 --> 00:02:59,150
If I actually go to the Design tab now you can see that we have our linearly elsewhere Tikal here.

44
00:02:59,480 --> 00:03:06,400
So now let's I want to actually drag our linear layout horizontal here.

45
00:03:06,400 --> 00:03:08,480
So let's say this pallet section.

46
00:03:08,480 --> 00:03:13,490
Just click on layouts and select it linearly or horizontally and dragged here into this linearly or

47
00:03:13,550 --> 00:03:14,440
vertical.

48
00:03:14,810 --> 00:03:18,960
So now we have this linearly horizontal inside this linearly Oswestry call.

49
00:03:19,190 --> 00:03:23,960
So let's actually change some properties of this linearly authorities on onto.

50
00:03:23,960 --> 00:03:32,290
So for the layout height Let's actually assign the value of raw content and for the layout which I think

51
00:03:32,390 --> 00:03:33,740
match parent is cute.

52
00:03:33,950 --> 00:03:38,080
So I've got to actually track some mixed views into this linearly as what is on.

53
00:03:38,390 --> 00:03:44,720
So click on this widget see it inside this palette section and select is text view and just dragged

54
00:03:44,720 --> 00:03:49,320
him into this componentry section and put it inside this linearly out horizontally.

55
00:03:49,760 --> 00:03:54,290
Now this linearly at horizontal holds this takes view right.

56
00:03:54,320 --> 00:04:01,880
So just select this text view and because I want to actually touch about to lay out wait in this tutorial

57
00:04:02,270 --> 00:04:08,390
for the actually for the layout we can see that we have our content content and for the are height we

58
00:04:08,390 --> 00:04:10,100
have our content right.

59
00:04:10,100 --> 00:04:17,240
So let's now write another text view into our linearly or horizontally against Celtic estates and just

60
00:04:17,240 --> 00:04:18,150
put it here below.

61
00:04:18,190 --> 00:04:21,650
This takes you there is actually Enceladus linearly outhaul is on.

62
00:04:21,830 --> 00:04:26,520
So now this linearly or horizontal holds two text views right.

63
00:04:26,540 --> 00:04:32,960
We have one text here and we have our second takes here the value of the length of both of these takes

64
00:04:32,960 --> 00:04:35,020
views is actually rap content.

65
00:04:35,210 --> 00:04:36,350
Right.

66
00:04:36,410 --> 00:04:44,820
And these two takes views are inside these linearly or horizontal but now you may ask so why.

67
00:04:45,080 --> 00:04:48,430
Actually this text is not wrapped.

68
00:04:48,560 --> 00:04:49,010
Right.

69
00:04:49,010 --> 00:04:49,420
It is.

70
00:04:49,520 --> 00:04:54,480
It's it is rap content but you can see that the Tick's view here the text is not up.

71
00:04:54,490 --> 00:04:55,200
Why.

72
00:04:55,220 --> 00:05:00,020
Because the pattern to lay out which is actually that is one linearly al-Hadi horizontally.

73
00:05:00,580 --> 00:05:07,430
They'll lay out a of this linearly or horizontal is much parent and match pennance means that the Viets

74
00:05:08,150 --> 00:05:14,910
of these linearly horizontal is going to actually take the entire bit that is actually remained here.

75
00:05:14,930 --> 00:05:21,430
So that means that whatever user interface components that we put here must actually correspond to the

76
00:05:21,490 --> 00:05:22,540
lay out of it.

77
00:05:22,700 --> 00:05:23,260
Right.

78
00:05:23,300 --> 00:05:29,420
Because the linearly add horizontal is going to take the entire week here and our text views are actually

79
00:05:29,420 --> 00:05:36,620
inside linearly or horizontal we can see that these the width of these text views charity related in

80
00:05:36,620 --> 00:05:41,960
a way to take the entire actually Viets of their linearly and horizontal.

81
00:05:42,230 --> 00:05:43,670
So how we can solve this problem.

82
00:05:43,750 --> 00:05:45,250
Oh you want this takes view.

83
00:05:45,410 --> 00:05:48,030
He wants the text to be of this text.

84
00:05:48,210 --> 00:05:52,660
But actually that lay out which of these takes you to be rap content.

85
00:05:52,700 --> 00:05:52,940
Right.

86
00:05:52,940 --> 00:05:55,630
I want to this content to be wrapped.

87
00:05:55,730 --> 00:06:01,170
So just click on this linearly at horizontal and for the layout of the assigned wrapped content.

88
00:06:01,280 --> 00:06:09,500
Now you can see that the text of this text views is actually lapped right.

89
00:06:09,620 --> 00:06:11,140
So that's it.

90
00:06:11,180 --> 00:06:16,370
And now I want to talk about talk about the lay out the weight.

91
00:06:16,520 --> 00:06:16,900
Right.

92
00:06:17,030 --> 00:06:20,260
So now let's actually select this takes few here.

93
00:06:20,600 --> 00:06:24,330
And for the layout we assign the values zero right.

94
00:06:24,350 --> 00:06:26,540
I assign the value zero for the length of each.

95
00:06:26,870 --> 00:06:29,880
And because I assigned the value zero for the level of each.

96
00:06:30,080 --> 00:06:38,360
All you need to assign a value for there actually have to wait so let's actually go go to the properties

97
00:06:38,360 --> 00:06:41,990
here you can see that we have this option that says View all properties.

98
00:06:41,990 --> 00:06:43,360
Just click on it.

99
00:06:43,430 --> 00:06:44,980
Now let's find out.

100
00:06:44,990 --> 00:06:50,810
Wait here we can see that because this is actually inside linearly out this linear horizontal we can

101
00:06:50,810 --> 00:06:52,520
use this outwait.

102
00:06:52,700 --> 00:06:56,880
So for the out weight here of these text.

103
00:06:56,930 --> 00:07:03,680
So I want this takes you to actually take 50 percent of the Viets of the patent right.

104
00:07:03,950 --> 00:07:08,510
So the patent is linearly at horizontal right but it is actually Lappe content.

105
00:07:08,570 --> 00:07:14,250
So I need to change it to match Pallant and let's select the state's view.

106
00:07:14,510 --> 00:07:19,830
So I told you that I want this takes you to take 50 percent of the feet of the parent.

107
00:07:20,050 --> 00:07:23,380
So that is the view for the outfits I assign the value zero.

108
00:07:23,540 --> 00:07:28,470
And for the lay out weight I can't assign the value 50 right.

109
00:07:29,300 --> 00:07:32,500
But now you can see that it is actually taking much more space.

110
00:07:32,540 --> 00:07:35,460
So that's because of the stakes here.

111
00:07:35,480 --> 00:07:38,200
So now let's say like this takes you here.

112
00:07:38,330 --> 00:07:39,980
This second takes you and all you want.

113
00:07:39,980 --> 00:07:45,620
This second takes you to also take 50 percent of the Viets of the parent which is this fun linearly

114
00:07:45,710 --> 00:07:51,450
horizontally so that it does takes you two and four to lay out with assigned values zero.

115
00:07:52,010 --> 00:07:54,600
And for the lay out weight is only value 50.

116
00:07:54,620 --> 00:08:02,360
So here you can see that each of these takes views is taking 50 percent of the lay out weight.

117
00:08:02,810 --> 00:08:10,580
So that's why for the layout of these linearly or horizontal I assigned the value match parents so it

118
00:08:10,580 --> 00:08:17,140
is going to actually take the entire width so that we have enough space for our text views here Enceladus

119
00:08:17,430 --> 00:08:19,640
or linearly out horizontal.

120
00:08:20,000 --> 00:08:25,510
So let's try another linearly or told this actually to direct another text view into our linearly or

121
00:08:25,500 --> 00:08:26,240
horizontally.

122
00:08:26,480 --> 00:08:31,760
So click on these widgets here and just click on takes you here and just drag it and put it BIDU this

123
00:08:31,760 --> 00:08:35,070
takes butu inside is linearly horizontal.

124
00:08:35,450 --> 00:08:37,930
So now we have free takes views right.

125
00:08:38,210 --> 00:08:48,530
So now you want each of these takes views to only take 30 percent of the entire actually linearly out

126
00:08:48,530 --> 00:08:49,260
horizontal.

127
00:08:49,280 --> 00:08:56,420
So in that case again just select all of these takes views here inside this componentry section for

128
00:08:56,420 --> 00:08:58,570
the layout of Viets assign the value zero.

129
00:08:58,940 --> 00:09:04,880
And for the layout rate here here assign the value 50 person enter the general table.

130
00:09:05,390 --> 00:09:13,580
So now these takes views are going to take 30 percent of them patently out which is going to be linearly

131
00:09:13,580 --> 00:09:17,220
or horizontally or if you want to be more exact.

132
00:09:17,390 --> 00:09:21,230
I can actually divide 100 by three.

133
00:09:21,260 --> 00:09:22,900
So let's see how we can do that.

134
00:09:23,030 --> 00:09:30,230
So in order to be more exact here I need to actually imagine just suppose that the entire width of this

135
00:09:30,230 --> 00:09:37,250
linearly or is this linearly horizontal is 100 souq 100 divided by.

136
00:09:37,880 --> 00:09:40,500
So if we have free takes views right 50.

137
00:09:40,640 --> 00:09:43,000
So it is going to be three point three.

138
00:09:43,010 --> 00:09:48,770
So for the lay out weight of all these takes views so going so this componentry section and Ceric all

139
00:09:48,770 --> 00:09:51,730
these takes viewers inside is linearly horizontal.

140
00:09:51,920 --> 00:09:57,050
And for the length weight assigned a value free point free and that person enter on your keyboard.

141
00:09:57,050 --> 00:09:58,770
So now it is more exact.

142
00:09:58,910 --> 00:10:01,230
It is more precise actually.

143
00:10:01,250 --> 00:10:09,330
So now we can see that these takes viewers inside this linearly holds onto are actually taking an equal

144
00:10:09,330 --> 00:10:10,810
vote here.

145
00:10:10,920 --> 00:10:11,460
Right.

146
00:10:11,490 --> 00:10:18,890
So the stakes actually takes only at three point three of these linearly or horizontal.

147
00:10:18,900 --> 00:10:24,930
So this is going to be depth actually the lay out rate but because we assign the value zero for the

148
00:10:24,930 --> 00:10:33,750
lay out and we assign the value free point free it is going to actually take one third of these linearly

149
00:10:33,750 --> 00:10:34,410
out horizontal.

150
00:10:34,410 --> 00:10:40,470
One friend of the beat of this linearly at horizontal and our second takes is actually the same again.

151
00:10:40,600 --> 00:10:43,300
We assign the value zero for the left right.

152
00:10:43,380 --> 00:10:49,080
So that's at the level which is not going to interfere with the lay out weight because all you want

153
00:10:49,080 --> 00:10:56,480
to specify the layout of this text view according to the other takes views here according to them.

154
00:10:56,610 --> 00:10:59,000
And Matt actually did a patently out.

155
00:10:59,130 --> 00:11:05,280
OK so I don't want to lay out the value of the lay out to interfere with that here.

156
00:11:05,430 --> 00:11:09,720
So let's take a look here is actually that this is 0 0.

157
00:11:09,960 --> 00:11:13,230
And for the lay out weight I assigned the value 3.3.

158
00:11:13,290 --> 00:11:19,740
So hopefully that makes sense and hopefully we can actually specify what is the difference between lay

159
00:11:19,740 --> 00:11:22,360
out we and the lay out weight.

160
00:11:22,490 --> 00:11:26,560
You could also use the lay out wait for the lay out height actually.

161
00:11:26,580 --> 00:11:32,790
But here in our case I just prefer to use the lay out with the lay out actually wait.

162
00:11:33,270 --> 00:11:40,530
And I told you the defense that why the rap content actually doesn't work for our specific user interface

163
00:11:40,530 --> 00:11:45,800
components for this for example for this takes view when it is inside linearly or horizontal.

164
00:11:45,930 --> 00:11:54,480
I told you that because the linearly or horizontal is actually match parent did actually rapin capability

165
00:11:54,480 --> 00:11:57,800
of our Takes view is going to be disabled.

166
00:11:57,840 --> 00:11:58,380
Why.

167
00:11:58,380 --> 00:12:04,950
Because our text views are actually inside a linearly or horizontal that it's we lay out which is match

168
00:12:04,950 --> 00:12:05,960
parent.

169
00:12:06,090 --> 00:12:12,420
So we need to also consider that because this text is a child of this linearly or horizontal and this

170
00:12:12,530 --> 00:12:17,230
linear horizontal is the parent of this takes view.

171
00:12:17,280 --> 00:12:21,690
So hopefully that makes sense if you have any questions about these concepts that it has to in this

172
00:12:21,690 --> 00:12:22,440
lesson.

173
00:12:22,440 --> 00:12:26,930
Please post the discussion in the course and then I do my best to answer all of your questions.

174
00:12:26,940 --> 00:12:29,460
Thank you very much for watching and I'll see you in the next story on.

