CHAPTER 8: Android UI Design: Using Advanced ViewGroup Layout Containers 285
Figure 8-17. Add android:layout_gravity=“right” parameters to
Once you have changed the parameter to invoke right-alignment of the widget, copy the parameter
from the first
child tags, so that all of the EditText fields align in the same fashion.
If you have not done so already, click on the Graphical Layout Editor tab at the bottom of the Eclipse
central editing pane, and render (preview) your UI design to see if you like the EditText fields aligning
with the Button UI elements. I moused-over the second EditText UI element before hitting the
PrintScreen button on my keyboard to “grab” the screenshot, so that you could see that the GLE
actually gives you real-time UI usage feedback, just like you would get inside of the Nexus One AVD
emulator.
As you can see from the moused-over EditText field, it aligns opposite the Button UI element
perfectly, and looks quite professional. Left-aligning (the default) or right-aligning the EditText fields
is largely a matter of taste, so simply let your client decide which look and feel is best.
It is also interesting to note that the GLE does not access your AndroidManifest.xml file to get your
app title value, so you will see the Hello Universe at the top of this screen until you run it in the
Nexus One AVD!