‫Welcome back.
‫We learned about the linear layout.
‫Now in this video we're going to learn about relative layout.
‫A relative layout is a viewgroup in Android that allows you to arrange a child views relative to each
‫other or relative to the parent view.
‫It's a versatile and powerful layout manager that offers more flexibility in positioning child views
‫compared to simpler layouts like linear layout.
‫You can create complex and customized user interfaces using Relative Layout, and to use a relative
‫layout in your Android application, you typically define it in your Xaml layout file.
‫For example, I replaced this linear layout with a relative layout tag.
‫Inside this relative layout tags that starts.
‫From here, we need to add the views.
‫We have three text views and they are overlapping, and they are placed on the top of each other.
‫In order to use the relative layout to arrange this child, we need to use some properties.
‫So inside the relative layout, you add a child views and specify their position relative to the other
‫views or the parent.
‫You do this using layout rules and attributes like Android layout, align parent, top layout below
‫layout to start off, and more.
‫For example, if I need to place this second text view below the first text view, I'll use an attribute
‫called layout below, and you specify the ID of the view that this text view will be placed below it.
‫Here the text view I'll give it an ID first text view and here this text view I'll give it an ID second
‫text view.
‫And here I specify the layout below the first text view and you can see this text view is placed directly
‫below the first text view.
‫Also, I can specify this for the last text view.
‫Give it an id.
‫I need to place it below the second text view.
‫I'll use layout below.
‫Second text view.
‫Here we go.
‫In this way I am placing them in a linear manner.
‫There are a lot of attributes you can use in relative layout, for example layout, align parent, top
‫bottom and start left, right and others.
‫These attributes allow you to align a child view with the top button start or end edge of the parent
‫relative layout.
‫For example, if I set the align parent end to true, it will move this text view to align the parent
‫end.
‫And this is the parent, and this is the parent end and is for the right side.
‫I'm aligning this text view with the end of the parent Linearlayout.
‫Also you can use align attribute, align top align button, align start and left right.
‫These attributes allow you to assign a child view with the top button start or end edge of another specific
‫view within the relative layout.
‫For example, align right and here you specify that another view.
‫I need to align this text view with the first text view.
‫So if you type this align right I align this text view with the first text view.
‫And to discover more about this relative layout you specify layout keyword.
‫And there are a lot of things you can specify in each of the views.
‫So this is how we use the relative layout in Android.
‫In the next video, we're going to learn about the most powerful layout in Android Studio, which is
‫the constraint layout.