XML
XML stands for eXtensible Markup Language. It was originally designed as a comprehensible way to
store and transport data. In the Android environment it is used to describe the user interface of your
application. It decouples the design of your app from the logic behind it. This is beneficial because
you can modify your user interface of your app without modifying your source code. You can create
XML layouts for different devices, screens and languages without duplicating logic.
Each Android XML layout typically starts with a ViewGroup. This element defines the way that child
elements behave.
Example: Two buttons (child elements) inside a linear layout (viewgroup) with
horizontal orientation will be placed horizontally beside each other.
XML
Rendered layout
Each individual layout element can have multiple properties. So will the android:text property define
the text of the button. Layout_width and layout_height define the height and width of the button. In
this case this means that the button will not be bigger than needed to wrap the content.
Please do note that the manner of defining a XML element without child nodes differs from one that
has child nodes.
Type 1: No childless XML element
The a childless XML element is starts with a
single <, followed by the type of element,
the properties, and ends with a />.
Type 2: Child nodes
The XML element with children starts
with a single <, followed by the type of
element, the properties, and a closing
tag >. Then the child elements are
defined. When all children are defined,
the parent element is closed with a
</type> tag.
For each element there are multiple properties with multiple options. To style each element to your
design, check the android documentation exhaustively at https://developer.android.com/index.html
More on XML:
https://www.w3schools.com/xml/
https://developer.android.com/guide/topics/ui/declaring-layout.html
https://developer.android.com/guide/topics/ui/declaring-layout.html#CommonLayouts