104 CHAPTER 4: Introduction to XML: Defining an Android App, Its Design, and Constants
Let’s take a look at the Relative Layout UI design in the activity_main.xml file, which Eclipse ADT
created for you as a UI layout foundation to start building your UI design upon for the HelloUniverse
Android application.
As you can see in Figure 4-1, the first line of the parent
has an xmlns:android=http://schemas.android.com/apk/res/android parameter. This parameter
defines the XML naming schema repository for Android OS as being in the schemas virtual server,
on the android.com Internet address, in the /apk/ folder, in a /res/ sub-folder, and finally in an
/android/ sub-sub-folder.
In this case, the
parameters that configures this tag. This parameter will allow this parent UI layout tag to reference
the XML naming scheme repository, and defines the prefix “android” as a short cut to reference
this repository. Note that just because it “references” the proper XML definition repository does not
mean that it is connecting in real-time to check this repository, as I pointed out earlier (it is used as a
unique identifier). As you can see inside of the
of parameters, a half-dozen of which start with android: and what this android: reference equates to
is defined by that first xmlns:android parameter.
Essentially, what is happening here is that the xmlns:android parameter is defining a “shortcut” for
all the other parameters that start with android: to be able to check themselves against the XML
naming schema repository.
Figure 4-1. The contents of the activity_main.xml file in the /res/layout folder in the Eclipse editing pane
tag. This parent tag will usually contain other “child” tags, which are “nested” inside of (underneath)
the parent tag. XML is so familial that way! The nesting of child tags, as well as tag parameters,
are more easily seen if the XML programmer uses indenting to show which tags are inside of other
higher-level (parent) tags, as you can see in Figure 4-1.