The basic building block for the user interface is a views object which is created from the View class and occupies a rectangular area on the screen and is responsible for drawing and event handling. The view is the base class for widgets, which are used to create interactive UI components like buttons, text fields, etc.
The view group is a subclass of views and provides an invisible container that holds other Views or other ViewGroups and defines their layout properties.
At the third level, we have different layouts which are subclasses of ViewGroup class and a typical layout defines the visual structure for an Android user interface and can be created either at run time using view objects or you can declare your layout using a simple XML file main_layout.xml which is located in the res/layout folder of your project.
Layout types:
LinearLayout
LinearLayout is a view group that aligns all children in a single direction, vertically or horizontally.
RelativeLayout
RelativeLayout is a view group that displays child views in relative positions.
TableLayout
TableLayout is a view that groups view into rows and columns.
AbsoluteLayout
AbsoluteLayout enables you to specify the exact location of its children.
תגובות