A (175)

(Tuis.) #1

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


Remember that if you don’t add an android:contentDescription parameter to any digital-image–related
widget, such as and , you will get a red error highlight in your markup.
So next, type in the android:c part of this parameter, and then select the contentDescription
parameter option, and set it to the value of @string/galaxyone, which will (soon) be a
constant with the data value of “Milky Way Galaxy.”


Next, let’s create three new constants for our three galaxy name content description
parameters, as is shown in Figure 8-23.


Figure 8-21. Copy the galaxybutton PNG24 images into your /workspace/HelloUniverse/res/drawable-hdpi folder


We will be learning how to support all of these different drawable folders in the next chapter when
we cover the art of Android graphic design.


Name the UI widget galaxyOne using the android:id parameter, and then set the
android:src image source file parameter to reference the @drawable/galaxybutton1 asset. Make
sure to copy the required layout_width and layout_height parameters from the tag
(above), set to wrap_content, as is shown in Figure 8-22.


Figure 8-22. Configure the tag with parameters and add a required contentDescription parameter

Free download pdf