CHAPTER 4: Introduction to XML: Defining an Android App, Its Design, and Constants 109
Next, we will take a look at the dimens.xml XML definition file, which is used to hold the dimension
constants and their data values used to define the dimensions, using pixel values to define layout
spacing, for an Android application’s UI design (or for more than one design, if you have defined
multiple Activity classes).
XML Dimensions: Editing Dimensions Using XML
Let’s take a look at the dimens.xml file in the /res/values folder and see what global application
margin spacing has been set up for your Android application by the Eclipse ADT New Android
Application Project series of dialogs. Right-click on the dimens.xml file and select the Open option
from the menu, or alternatively, left-click on the file name and use the F3 function key at the top of
your keyboard; either work process will work.
As you can see in Figure 4-4, there are two
value of 16 dp, or density pixels, in exactly the same way that the text string values were set. Here
is an example of the XML tag and parameter format used:
Figure 4-3. The edited constant values in the strings.xml file located in the /res/values folder