Saturday, October 5, 2019

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 will contain one or more activities and each activity is a one screen of app. The activities will 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 will 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
Like these we have many View subclasses available in android.

Android ViewGroup

The ViewGroup is a subclass of View and it will act as a base class for layouts and layouts parameters. The ViewGroup will provide 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.

Following are the commonly used ViewGroup subclasses in android applications.

  • Linear Layout
  • Relative Layout
  • Table Layout
  • Frame Layout
  • Web View
  • List View
  • Grid View
Both View and ViewGroup subclasses together will play a key role to create a layouts in android applications.

No comments:

Post a Comment

How to DROP SEQUENCE in Oracle?

  Oracle  DROP SEQUENCE   overview The  DROP SEQUENCE  the statement allows you to remove a sequence from the database. Here is the basic sy...