The main building block of the User Interface is the View object that can be created using the View class. It is used to provide a rectangular area on the screen and allows drawing on the screen with event handling. View class is the base class that comes under the Android Widgets category. Android Widgets are used to create interactive UI components such as input fields, buttons, texts, etc.
View class has a default subclass named as ViewGroup that provides an invisible container to hold Views or other subclasses such as ViewGroups. You also need to define the layout properties in the subclass defined under the View class.
There are several layouts in Android that you can use in your application development. These layouts include:
- Relative Layout: This layout is used to display child views in relative positions.
- Linear Layout: This type of layout is a view group that allows you to align all children in a single row whether it is vertical or horizontal.
- Absolute Layout: It allows you to specify the correct location of its children.
- List View: It is a view group layout that shows a list of scrollable items.
- Grid View: Grid view is a view group layout that shows items in a two-dimensional grid that is scrollable too.
- Frame Layout: This type of layout is a view group that displays a single view of the screen.