CHAPTER 15: Developing for Android Wearable Devices 561
Next, add the android:background parameter, referencing the earthtime image asset, as shown
in Figure 15-9.
Figure 15-9. Use the android:background parameter to reference the earthtime image and use layout_gravity to center it
Make sure that you change the layout_width and layout_height parameter constants to
wrap_content so that the watch face conforms to the square earth image background and to the
AnalogClock widget’s face, and not to your rectangular FrameLayout container. Finally, add an
android:layout_gravity parameter and set it to use the center constant, so that the new watch face
centers itself inside of the Neptune Pine smartwatch hardware (display screen).
Now you are ready to use the Graphical Layout Editor tab (at the bottom-left of the central editing
pane) to preview your UI design. As you can see in Figure 15-10, the EarthTime AnalogClock widget
is centering itself in the AVD emulator, and the widget’s UI elements overlay the background image
perfectly and quite professionally.