Challenge: From Button to ImageButton

Perhaps the UI would look even better if the next and previous buttons showed only icons, as in Figure 2.14.

Figure 2.14  Icon-only buttons

Icon-only buttons

To accomplish this challenge, these two widgets must become ImageButtons instead of regular Buttons.

ImageButton is a widget that inherits from ImageView. Button, on the other hand, inherits from TextView. Figure 2.15 shows their different inheritance hierarchies.

Figure 2.15  Inheritance diagram for ImageButton and Button

Inheritance diagram for ImageButton and Button

You ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.