Android View and ViewGroup With Examples
Android View and ViewGroup With Examples
1
Android View and ViewGroup with Examples
In android, Layout is used to define the user interface for an app or activity and it will hold the UI
elements that will appear to the user.
The user interface in android app is made with a collection of View and ViewGroup objects. Generally,
the android apps contain one or more activities and each activity is a one screen of app. The activities
contain a multiple UI components and those UI components are the instances
of View and ViewGroup subclasses.
The user interface in android app is made with a collection of View and ViewGroup objects. Generally,
the android apps will contain one or more activities and each activity is a one screen of app. The
activities contain a multiple UI components and those UI components are the instances
of View and ViewGroup subclasses.
Android View
The View is a base class for all UI components in android. For example, the EditText class is used to
accept the input from users in android apps, which is a sub class of View.
Following are the some of common View subclasses which will be used in android applications.
TextView
EditText
Button
CheckBox
RadioButton
ImageButton
Progress Bar
Spinner
Android ViewGroup
The ViewGroup is a subclass of View and it acts as a base class for layouts and layouts parameters.
The ViewGroup provides an invisible containers to hold other Views or ViewGroups and to define the
layout properties.
For example, Linear Layout is the ViewGroup that contains a UI controls like button, textview, etc. and
other layouts also.
1
Both View and ViewGroup subclasses together will play a key role to create a layouts in android
applications.
Questions