View, ViewGroup, Layout, and Widget
This section describes UI class and object terminologies used in Android SDK documentation. View and ViewGroup are base classes serving as UI building blocks. Widget and Layout are classes extended from View or ViewGroup class providing specific UI functions.
In the Android SDK documentation, there are 4 terms used to refer to different parts of the user interface (UI) class hierarchy:
- View - Refer to the android.view.View class, which is the base class of all UI classes.
android.view.View class is the root of the UI class hierarchy.
So from an object point of view, all UI objects are View objects.
- ViewGroup - Refer to the android.view.ViewGroup class, which is the base class
of some special UI classes that can contain other View objects as children.
Since ViewGroup objects are also View objects, multiple ViewGroup objects and View objects
can be organized into an object tree to build complex UI structure.
- Widget - Refer to any UI class that provides a specific simple or complex UI function.
A simple Widget can use single View object. A complex Widget can use a View object tree with many
ViewGroup objects and View objects.
- Layout - Refer to any UI class that is specially designed to place child View objects into a UI pattern.
Obviously, a Layout has to be a subclass of the android.view.View.ViewGroup.
Examples of UI classes:
- The android.widget.Button class is a Widget class that represents a simple UI component with a single View object.
- The android.widget.LinearLayout class is a Widget class and also a Layout class
that represents a complex UI component with a ViewGroup object containing other View objects as children.
Child View objects in a LinearLayout object are placed on the UI in a linear pattern.
- The android.widget.DatePicker class is a Widget class that represents a very complex UI component
with a ViewGroup object containing year, month, and day spinners. Each spinner is a ViewGroupd object
containing years, months, or days as View objects for users to select.
When building your own UI, you can search and find a Widget class provided in the Android SDK
that matches your UI structure. Then you extend a new class from that Widget class to add your
If you want build your UI from scratch, you can just start with a ViewGroup object, add child ViewGroup or
View objects repeatedly to build a View object tree, then customize each View or ViewGroup object to complete
the UI structure.
Last update: 2015.
Table of Contents
About This Book
Installing JDK 1.8 on Windows System
Installation of Android SDK R24 and Emulator
Installing Apache Ant 1.9 on Windows System
Developing First Android Application - HelloAndroid
Android Application Package (APK) Files
Android Debug Bridge (adb) Tool
Android File Systems
Android 4.0.3 File Systems
AboutAndroid - Application to Retrieve System Information
android.app.Activity Class and Activity Lifecycle
►View Objects and Layout Resource Files
android.view.View Class - Base of User Interface Components
►View, ViewGroup, Layout, and Widget
What Is Layout Resource File?
AndroidView v1.0 - Creating a Layout in Java Class
AndroidView v2.0 - Creating a Layout in Resource File
AndroidView v3.0 - Referencing Views in Resource Files
AndroidView v3.1 - Layouts with Vertical Orientation
AndroidView v3.2 - Layouts with Horizontal Orientation
AndroidView v4.0 - Inserting Views to Parent Layout
Using "adb logcat" Command for Debugging
Build Process and Package File Content
Building Your Own Web Browser
Android Command Line Shell
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
Android Tablet - LG-V905R
USB Debugging Applications on LG-V905R Tablet
Android Phone - LG-P925g
USB Debugging Applications on LG-P925g Phone
PDF Printing Version