"One XML file has only one root tag"
So why is this root tag important ๐
The answer is when we take root tag through layout (just like canvas is used to paint, right... We take layout in order to use View and ViewGroup)
If you want to use lots of View and/or lots of ViewGroup then you have to take a root layout which is ViewGroup in which we can use multiple ViewGroup.
Note :- Every layout is ViewGroup but every ViewGroup need not to be a layout ๐ฅฒ
In Android there are lots of layouts. Here are some Common layouts listed
- Example
- 1) Linear Layout
- 2) Relative Layout
- 3) Web View
and more...
But by default in Android Studio we get constraint layout.
We'll be discussing a brief idea about mandatory attributes of root element and more about layouts in upcoming Part 2.Till then...
Stay tuned ๐
ย