A (175)

(Tuis.) #1
CHAPTER 6: Android Screen Design: Writing to the Display Using Activity and View 191

As you can see from my pseudo markup above, the parent is now configured to be
horizontal, and thus will arrange everything inside of it from side-to-side instead of top-down. The
parent tag still contains the digital image asset reference, as we want this image to fill the screen
behind our UI design. There are now two child tags nested inside the horizontal
parent both of which are vertical, and both of which have defined a transparency
value for their background so that the parent background image will show through. If this is not
done, Eclipse “throws” a warning that the parent background has been rendered useless because it
is now covered up by the child layout containers. Inside of the vertical child tags are
the seven or so grandchild tags (no, they are not really called that), which are child tags
of the child tags, hence the “nesting” terminology. Let’s hope Dr. Phil never learns
Android, or we may have to cover the psychology of Android parent-child familial relationships in a
future version of this book.


Eclipse Tricks and Treats for Using the XML Editing Pane


Another Eclipse shortcut to get a child tag helper dialog is to use a left-facing chevron < character,
to bring up the helper dialog, as is shown in Figure 6-23. Put your cursor at the end of the opening


tag and hit the return key, which will auto-indent your code for you, and type a “<”
character and wait for the pop-up to appear, with all of the child tags (widgets and layout containers)
that are compatible with the parent container.

Figure 6-23. Use a left chevron < character inside the parent LinearLayout tag to invoke a child tag helper dialog

Free download pdf