CHAPTER 8: Android UI Design: Using Advanced ViewGroup Layout Containers 279
GridLayout Child Widget Parameters: Specifying Layout
Let’s add android:layout_row parameters in the four
values from 0 through 4, and android:layout_column parameters specifying the first column index,
which is zero, since in computer programming things are numbered starting with zero.
Your XML markup for these four
this markup in Figure 8-12:
<EditText android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/edit_colony" android:hint="@string/hint_colony" android:layout_row="0"
android:textColorHint="#FFFFFF" android:textColor="#FFFFFF" android:layout_column="0" />
<EditText android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/edit_pop" android:hint="@string/hint_pop" android:layout_row="1"
android:textColor="#FFFFFF" android:textColorHint="#FFFFFF" android:layout_column="0" />
<EditText android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/edit_fleet" android:hint="@string/hint_fleet" android:layout_row="2"
android:textColor="#FFFFFF" android:textColorHint="#FFFFFF" android:layout_column="0" />
<EditText android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/edit_ships" android:hint="@string/hint_ships" android:layout_row="3"
android:textColor="#FFFFFF" android:textColorHint="#FFFFFF" android:layout_column="0" />
Figure 8-12. Add layout_row and layout_column child widget parameters, defining precise UI element grid layout
Use the GLE to preview the android:layout_row and android:layout_column parameters, as can be
seen in Figure 8-13.