A (175)

(Tuis.) #1

186 CHAPTER 6: Android Screen Design: Writing to the Display Using Activity and View


Using Digital Imagery: Adding a Galaxy Background


I have prepared a galaxyinfoscreen.png digital image file to use as the background image, which
is in the book assets’ ZIP file. Open the ZIP file, or better yet, extract it to your hard disk drive on
your workstation, right-click on the galaxyinfoscreen.png image, and select the Copy menu item.
Then find your /workspace folder on your hard disk drive, it should be in a C:/Users/ComputerName
folder. Right-click on the /res/drawable-xhdpi subfolder, and then select the Paste option, which
will paste the image into that folder, as shown in Figure 6-18.


Figure 6-18. Copy the galaxyinfoscreen.png file into the drawable-xhdpi folder; right-click and Refresh the project


Once you copy this digital image file into your /res/drawable-xhdpi folder using this procedure, you
need to let Eclipse know that you have updated your project “outside” of Eclipse, so that Eclipse
can rescan your project folder hierarchy and “see” any new files. This is done using the “Refresh”
menu option. Access the Refresh utility by right-clicking on your HelloUniverse project folder in the
Eclipse Package Explorer pane to access the context-sensitive menu, as shown on the right side of
Figure 6-18.


Once you have copied the galaxyinfoscreen.png file into the drawable-xhdpi folder and used the
Refresh tool, the file will appear in your Package Explorer pane as seen highlighted on the bottom-
left of Figure 6-19. Now you are ready to add an android:background parameter to your parent


tag that will place this background image behind every UI widget that you place
inside of this container, giving your UI design a hip scenic background, and making your UI design
more visually appealing.
Free download pdf