View groups

A view group is a special kind of view that is capable of containing views. A view group that contains one or more views is commonly referred to as a parent view and the views contained as its children views. A view group is the parent class of several other view containers. Some examples of view groups are LinearLayout, CoordinatorLayout, ConstriantLayout, RelativeLayout, AbsoluteLayout, GridLayout, and FrameLayout.

View groups can be created within an XML layout in a source file:

<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginBottom="16dp"/>

Similar to views, view groups can be created programmatically within component classes. In the ...

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.