4.5 Building the App’s GUI

In this section, you’ll build the Flag Quiz app’s user interface. In the two previous chapters, you saw how to create a GUI and configure component properties, so Sections 4.5.14.5.4 focus primarily on new features. Many of the component properties you need to set are specified in tables.

4.5.1 activity_main.xml Layout for Devices in Portrait Orientation

In the two prior apps, you defined the app’s GUI in activity_main.xml. When working with Fragments, an Actvity’s GUI typically displays one or more Fragments’ GUIs. In this app, the layout for MainActivityactivity_main.xml—uses an <include> element in the XML to include in MainActivity’s layout the GUI defined in content_main.xml. The content_main.xml layout, in ...

Get Android How to Program, 3/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.