A (175)

(Tuis.) #1
CHAPTER 4: Introduction to XML: Defining an Android App, Its Design, and Constants 121

If you are wondering why I have been capitalizing color names during this chapter, such as White,
Black, Cyan, LightGray, and MediumGray, it is because these are Android Color Constants, and
I wanted you to get used to them in the format that you will be utilizing them in within your
application design and development process.


Now let’s take a look at how XML menu definitions are handled within the Android application
development work process. To access the Options Menu, provided by the Android OptionsMenu
class, click on the three dots on the right-hand side of the ActionBar to access this menu structure,
which we will be adding to as we progress through the book. I have added a screen shot on the right
side of Figure 4-15, to show this menu access visually.


XML Menus: Designing Menus for Android Apps


Let’s take a look at the Options Menu bootstrap which the Eclipse ADT New Android Application
Project series of dialogs created for you in the /res/menu folder named main.xml, after the Main
Activity class. Android uses lowercase letters and numbers for file names, as a standard or
“convention.” You can also use an underscore character, as you have seen already, in the
ic_launcher.png and activity_main.xml file names. Right-click on the main.xml file, and select the
Open option to open this main.xml in the Eclipse IDE, as shown in Figure 4-16.


Figure 4-15. Viewing the Android 4.x Holo Light theme in the Nexus One AVD, and showing the Options Menu

Free download pdf