CHAPTER 6: Android Screen Design: Writing to the Display Using Activity and View 187
Figure 6-19. Insert an android:background=“@drawable/galaxyinfoscreen” parameter into the parent LinearLayout
To add this parameter, you can type in android and the colon key, select the background
parameter, and double-click it, or you can just type the entire parameter in along with the proper
@drawable/ path reference to the file, using the following XML mark-up:
android:background="@drawable/galaxyinfoscreen"
The reason we do not use @drawable-xhdpi/galaxyinfoscreen is because the Android OS will
choose which drawable resolution density asset to use for any given Android hardware device
screen specification. In the case where there is only one image asset available, such as this, it will
simply use that. We will be covering how to develop multiple graphic image assets in Chapter 9, but
for now, we’ll just use one extra high definition (XHD) image asset.
Now let’s use the Run As ➤ Android Application menu sequence, which can be accessed by
right-clicking on the HelloUniverse project folder, or alternately via Eclipse’s Run menu (Run ➤ Run
As ➤ Android Application) and see how the galaxy image looks behind our current galaxy
information screen UI design.
As you can see in the left-hand pane of Figure 6-20, the contrast between the dark gray UI text
color and the galaxy space image makes the text quite difficult, if not impossible, to read, unless it
is in front of a very bright star, like the “e” character that you can see is the only easily discernable
character in the UI design currently!