CHAPTER 7: Making Apps Interactive: Intents, Event Handling, and Menus 241
Add an android:layout_below and android:layout_alignLeft parameter, and have each of them
reference the edit_colony
following XML markup:
android:layout_below="@+id/edit_colony" android:layout_alignLeft="@+id/edit_colony"
The first parameter will apply RelativeLayout positioning to the second
positioning it below the first
The second parameter will apply RelativeLayout alignment to the second
element, aligning it using the left side of each of the
android:layout_alignLeft parameter.
Let’s click the Graphical Layout tab and preview what these parameters do for our UI design. As you
can see in Figure 7-25, the EditText UI elements line up perfectly, but the second Button UI element
is not toRightOf the EditText UI element as you specified. Or is it? In fact, the second Button UI
element is to the right of EditText, according to the Y axis dimension; however, it is aligned with the
top of the screen next to the other Button! This is the default alignment, unless otherwise specified,
so we will have to add some RelativeLayout alignment parameters to the second
Figure 7-24. Adding a Galaxy Population