A (175)

(Tuis.) #1
CHAPTER 6: Android Screen Design: Writing to the Display Using Activity and View 171

There are 63 known indirect subclasses of the View class, which are essentially subclasses of the
11 known direct subclasses. These are UI elements, known as widgets in Android, and you will be
learning about some of these during the course of this book. Since ViewGroup (UI layout) subclasses
are just as important as the View (UI widgets) subclasses that are contained inside them, the
ViewGroup class also has dozens of direct and indirect subclasses with unique UI layout features or
options. However, the ViewGroup class doesn’t have quite as many subclasses as the View class
does. Since referencing the Android developer web site page for the class you’re using is always a
smart thing to do, I’ll provide these URLs. The ViewGroup class is located at this URL:


http://developer.android.com/reference/android/view/ViewGroup.html


If you take a look at this ViewGroup class reference page to see what the class is capable of, you will
see that the ViewGroup class has 12 known direct subclasses, one of which is the RelativeLayout
class that your XML UI layout definition is currently using for the HelloUniverse app currently. There
are 30 known indirect subclasses providing more specialized UI design layout containers, because
as subclasses get further down in the hierarchy they become more specialized. We’ll be looking at
several of the most popular ViewGroup subclasses in Chapters 7 and 8 covering UI layout design.


When using ViewGroup subclasses, termed UI layout containers in Android, and View subclasses,
termed UI widgets in Android, the View widgets are contained inside of the ViewGroup layout
containers, which is why the class is named ViewGroup, as it groups your View objects together into
a UI layout design, as shown in Figure 6-2. The ViewGroup layout design is then referenced inside of,
or contained in, your Activity.


Figure 6-2. Activity subclass contains UI design created with ViewGroup layout containers and View UI widgets

Free download pdf