A (175)

(Tuis.) #1

270 CHAPTER 8: Android UI Design: Using Advanced ViewGroup Layout Containers


After making this change, use the CTRL-S keystroke combination, and Save the file, which will then
evaluate the XML markup, as well as the effects of this markup across all of the XML markup and
Java code in your entire project in Eclipse. This will remove the red error highlighting across your
entire HelloUniverse project, which will remove error (and warning) highlights and icons from the
Package Explorer pane, the Outline pane, and each of the editing tabs which might be open in the
central editing pane.


This will also remove the errors from the error-related tabs at the bottom of the Eclipse IDE, which
are located underneath the Outline and Editing panes. It is important that you become familiar with
all of these areas of the Eclipse IDE and use each of them to the fullest development advantage!


As you can see in Figure 8-2, this Minimum Required SDK Version parameter change gives you a
clean project again. Figure 8-2 also shows how your XML markup will look after you click on your
activity_edit.xml editing tab, and remove all of the RelativeLayout class layout parameters, including:
layout_margin, layout_toRightOf, layout_alignLeft, layout_alignBaseline, and layout_below, so you
are reverting back to a “virgin” layout design.


We are doing this so that you can learn how to produce this same design, using (fewer) GridLayout
parameters.


Removing these RelativeLayout.LayoutParams class’s UI layout parameters will allow you to
reduce your XML markup by 33%, from a lengthy 36 lines of markup, to a mere 24 lines of markup,
as is shown in Figure 8-3.


Figure 8-3. Deleting the 17 margin, baseline, toRightOf, below, and alignLeft relative layout alignment parameters

Free download pdf