Android User Interface (UI)


Android provides a variety of pre-build UI components such as structured layout objects and UI controls that allow you to build the graphical UI for your app. Android also provides other UI modules for special interfaces such as dialogs, notifications, and menus. All UI elements in an Android app are built using the following two objects:
View
It draws something (such as button or text field) on the screen that the user can interact with.
ViewGroup
It holds other View (and ViewGroup) objects in order to define the layout of the interface (such as a linear or relative layout).

User Interface Layout
The user interface for each component of your app is defined using a hierarchy of View and ViewGroup objects, as shown in the figure.

Each view group is an invisible container that organizes child views, while the child views may be input controls or other widgets that draw some part of the UI.

This hierarchy tree can be as simple or complex as you need it to be (but simplicity is best for performance). To declare your layout, you can instantiate View objects in code and start building a tree, but the easiest and most effective way to define your layout is with an XML file. XML offers a human-readable structure for the layout, similar to HTML.