YouSub
Untitled

en English

Untitled English subtitles

0 downloads · 45 lines · added Dec 12, 2015

Report a problem
What's wrong?
Advertisement

English transcript

I'm going to draw out the view hierarchy diagram for options A, B, and C.
We'll start with option A.
It contains a LinearLayout as the root view.
So let me draw that.
Then I want to figure out the next layer of the view hierarchy,
which would be the direct children of this LinearLayout.
I'm going to scroll through the XML file to figure out the direct children
of this LinearLayout.
We have a TextView, a LinearLayout, another TextView, another TextView,
and then a Button.
So let me draw that in.
Cool, that looks good, but
we actually skipped over a bunch of XML related to this LinearLayout.
This nested LinearLayout contains a Button, a TextView, and a Button.
Let's draw those in.
This is the view hierarchy diagram for option A.
At a high level, there is a parent LinearLayout as the root view.
It contains five children views, and one of the children
actually is a LinearLayout that contains three more views.
Great, let's move on to option B.
In option B, we have a parent LinearLayout as a root view again.
Now, we can figure out the direct children of this LinearLayout.
We have a TextView, a LinearLayout, another TextView, another TextView,
and a Button.
This nested LinearLayout also has more children.
We have a Button, a TextView, and another Button.
Hopefully, you're getting the idea of how to read an XML file
by looking at the outermost parent first and then going inwards from there.
And last but not least, we have option C.
The root view is a LinearLayout again.
Let's look for its direct children.
We have a LinearLayout followed by a TextView, a TextView, and a button.
Okay, good, so this is a view hierarchy diagram for option C.
This looks a little bit different than the other options, so
let's compare them side by side.
Here are all the options side by side.
A and B have very similar view hierarchies whereas option C
has a different view hierarchy.
This LinearLayout has only four children as opposed to five children in
the other cases.
Also, since A and B look very similar, we're going to have to look more closely
at the XML to determine what the difference is between the two.
In the next quiz, you'll look more closely at the XML for each option.
Then I'll ask you to decide which option you think
best accurately describes the layout that we want to build.

Need subtitles from another video?