Difference between View and ViewGroup in Android

user3927549 picture user3927549 · Dec 8, 2014 · Viewed 98k times · Source

What is the difference between a View and a ViewGroup in Android programming?

Answer

saibaba vali picture saibaba vali · Jan 8, 2016

View

  1. View objects are the basic building blocks of User Interface(UI) elements in Android.
  2. View is a simple rectangle box which responds to the user's actions.
  3. Examples are EditText, Button, CheckBox etc..
  4. View refers to the android.view.View class, which is the base class of all UI classes.

ViewGroup

  1. ViewGroup is the invisible container. It holds View and ViewGroup
  2. For example, LinearLayout is the ViewGroup that contains Button(View), and other Layouts also.
  3. ViewGroup is the base class for Layouts.