Multiple Layouts and Views to design a GUI
As we studied about different Views and ViewGroups and Layouts in the previous tutorials and now it’s time to study how to use all of them together in our android project to design great user interfaces. So In this tutorial, we are going to learn how we can put different layouts and views and view groups inside another layout(hierarchical arrangement) to design the perfect GUI for your android application.
Defining the design in layout XML file
- In the Screen design above have a root element which is RelativeLayout. Which means that all its children and whether it is layouts or views will be arranged in a relative fashion. So, it we have to use is very important to choose our root layout carefully.
- Next, we have to use Linear Layout, whose orientation is set to vertical. This means that all the elements inside this Linear Layout will be arranged in a vertical fashion.
- Next, we have used another Linear Layout, whose orientation is set to horizontal. so, as you can see, we can have different layouts placed inside a root layout.
- Next, we have used another Relative Layout placed inside the root Relative Layout and the Relative Layout has 4 buttons inside it, arranged in a relative fashion to each other.
- All these layouts are placed inside a Relative Layout, So all these layouts are relative to each other.
Android provides a very structured way of designing the user interface or screen designing and that we have to understand how to use various layouts and views or view groups and go ahead design some great UI screens for your app.