A (175)

(Tuis.) #1

190 CHAPTER 6: Android Screen Design: Writing to the Display Using Activity and View


To confirm that you have solved your contrast problem, use the Run As ➤ Android Application
menu sequence, and compile and run your Hello Universe application. What you should see
should look like the middle section of Figure 6-20, and your Galaxy Information Screen’s Galaxy
characteristics text labels should now be readable!


Nested LinearLayout Containers: Creating a More Complex UI


To add in the UI elements that will be updated by your Java logic (in the next section) to
display the actual Galaxy object data values, we cannot simply add seven more child
tags into the existing parent tag, as that would put the values underneath the text
labels, and not to the right of them.


The solution to this UI layout problem using containers is to nest two vertical
LinearLayout child containers inside of a parent LinearLayout container configured as a horizontal
layout, which will place two rows of (matching) text next to each other horizontally, kind of like a
spreadsheet would. At a high-level tag overview, using pseudo markup, if you will, the basic XML
structure that you will be building soon would look something like this:




UI Labels


UI Data Fields


Figure 6-22. Add android:textColor=“#FFFFFF” parameters to all eight child tags in the LinearLayout

Free download pdf