Android View and ViewGroup

I think you're getting too hung up on the wording.

A "ViewGroup" has every bit as much reason to inherit from a "View" as a "TextView", and "ImageView" or ... more to the point ... a "ScrollView" or a "SurfaceView" (the latter two both "contain things").

Perhaps "View" wasn't necessarily the best choice of terms ... but the class heirarchy makes complete sense. Regardless of what it's subclasses are named :)

IMHO ...


Reading the official doc is the golden rule.

A ViewGroup is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers. This class also defines the ViewGroup.LayoutParams class which serves as the base class for layouts parameters.


If you still do not find out what it is, search with Google image:

enter image description here


I think this is a great example of the Composite design pattern:

http://en.wikipedia.org/wiki/Composite_pattern

Even though the naming might not be the best...