A (175)

(Tuis.) #1

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


It is a bit confusing having the GLE icon for Set Horizontal Orientation using vertical columns, and
the GLE icon for Set Vertical Orientation using horizontal rows, but you will get used to it as time
goes on.


Click on the currently unselected Set Vertical Orientation icon, which depicts row layout ordering,
as is shown in Figure 8-11. As you can see, this changes the distribution of the UI widgets, so that
now they are placed into the grid cells in exactly the way you want them to be, and you are back to
having the desired UI layout result.


Figure 8-11. Use the Set Vertical Orientation toggle icon (at top-left) to change the grid layout ordering algorithm


I have now shown you that with the type of UI widget ordering (every other one) you would use
in a RelativeLayout UI container as well as the type of UI widget ordering (collected together) you
would use in a LinearLayout UI container, there is an orientation setting (horizontal or vertical) in the
GridLayout parent container which will organize them the way that you want them to display.


You can also specify your grid UI row and column positioning within each of the child tags inside
of the parent GridLayout container, so you could have your child tags randomly specified, and still
achieve this layout result. This is done using the layout_row and layout_column parameters shown in
Table 8-1.


We are going to do this next, since this is the most memory-efficient way to specify a GridLayout UI
design, and the most precise, since we are specifically defining the grid index locations for each of
our child UI elements.

Free download pdf