Advertisement
English transcript
To answer this question, let's compare the two so that you can choose.
LinearLayouts are great for aligning views in rows or columns.
They're a good way to divide up one space using layout weights
that will expand or shrink views depending on the size of the display.
On the other hand, RelativeLayouts are great for
positioning elements relative to one another.
For example, putting B below A, or putting C in the lower left-hand corner.
RelativeLayouts also make it easy to overlap views.
For example, here view A is overlapping view B.
For our card, we don't really have a line of horizontal or vertical views.
And as you can see, some of these views overlap.
So in this case, a RelativeLayout makes a lot more sense.
And with a RelativeLayout,
I can use specific attributes to position these two TextViews.
Instead of talking about all that here though,
you'll tell me what do in the next few questions.
LinearLayouts are great for aligning views in rows or columns.
They're a good way to divide up one space using layout weights
that will expand or shrink views depending on the size of the display.
On the other hand, RelativeLayouts are great for
positioning elements relative to one another.
For example, putting B below A, or putting C in the lower left-hand corner.
RelativeLayouts also make it easy to overlap views.
For example, here view A is overlapping view B.
For our card, we don't really have a line of horizontal or vertical views.
And as you can see, some of these views overlap.
So in this case, a RelativeLayout makes a lot more sense.
And with a RelativeLayout,
I can use specific attributes to position these two TextViews.
Instead of talking about all that here though,
you'll tell me what do in the next few questions.