Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In this section, you’ll build the GUI for the Flag Quiz Game app. You’ll create a second XML layout that will be dynamically inflated to create the country-name Buttons that represent each quiz question’s possible answers. You’ll also create an XML representation of the shake animation that’s applied to the flag image when the user guesses incorrectly.
In this app, we use main.xml’s default vertical LinearLayout. Figure 6.7 shows the app’s GUI component names. Recall that, for clarity, our naming convention is to use the GUI component’s class name in each component’s Id property in the XML layout and in each variable name in the Java code.