What is "android-layout"

A layout defines the visual structure of the user interface.

The framework Android provides two modes to declare a layout:

  • Declaration of visual elements in an XML file.

    Android provides an XML vocabulary that corresponds to View classes and subclasses. Files must be placed in the folder /res/layout, within the application folder structure.

  • Instantiate visual elements at runtime.

    Programmatically, in java, create and manipulate objects of View and Viewgroup.

Modes can be used simultaneously: being declared in XML and then, programmatically using java, manipulating its properties and adding/removing new elements.

The advantage of the XML declaration is the separation of code from the user interface of the code that controls its behavior.
The statement of UI is external to the application code, that is, it is possible to modify or adapt it without modifying the source code and recompile.

In this way it is possible to create layouts for different orientations and screen sizes.

In addition, the XML layout statement allows the IDE to display the structure of its UI during encoding, making it easier to identify problems.

Source: Api Guides - Layouts