A (175)

(Tuis.) #1
CHAPTER 15: Developing for Android Wearable Devices 559

EarthTime UI Design: Styling an AnalogClock


Let’s start with the easier XML markup, and design a low-memory watch face (a skin). You will do
this using the FrameLayout class as the layout container, and the AnalogClock class as the UI
widget. As you can see in Figure 15-6, I am using Eclipse in a new way, by minimizing the Package
Explorer (far left) and Outline and Error views (far right) of the Eclipse UI, and using the entire area of
the IDE for my editing pane.


Figure 15-6. Add an child widget to a parent container to create the EarthTime clock


As you can see, the parent container is already coded for you, so change your ID
to earthTime and add a
closing tag. Then, use a left facing chevron < to open the
pop-up helper, and select and insert the child tag for your user interface widget.


Add an android:id parameter, and name the widget earthAnalogClock. Copy
and paste the two required android:layout_width and android:layout_height parameters from the


parent tag in the lines that come right before the child tag. Now
you are ready to add your background image!
Free download pdf