A (175)

(Tuis.) #1
CHAPTER 8: Android UI Design: Using Advanced ViewGroup Layout Containers 295

Figure 8-23. Adding constants with the ImageButton’s galaxy names for use with the contentDescription


The values for the three galaxy content descriptions should be “Milky Way Galaxy” for galaxyone,
“Andromeda Galaxy” for galaxytwo, and “Spiral Galaxy M106” for galaxythree. As I mentioned
previously in the book, I am using data and imagery from NASA, which is legally allowed to be
utilized for educational purposes, as I am doing here in this book.


The completed tag and parameters, shown in Figure 8-24, will look like the
following markup:


<ImageButton android:id="@+id/galaxyOne" android:src="@drawable/galaxybutton1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/galaxyone" />


Figure 8-24. Add a required layout_width and layout_height to and vertical orientation parameter

Free download pdf