5.4.6. activity_settings.xml Layout

In this section, you’ll create the layout for the SettingsActivity (Section 5.8) that will display the SettingsFragment (Section 5.7). The SettingsActivity’s layout will consist of only a LinearLayout containing the GUI for the SettingsFragment. As you’ll see, when you add a Fragment to a layout, the IDE can create the Fragment’s class for you. To create this layout, perform the following steps:

1. In the project’s res folder, right click layout and select New > Android XML File to display the New Android XML File dialog. Because you right clicked the layout folder, the dialog is preconfigured to add a Layout resource file.

2. In the File field, enter activity_settings.xml.

3. In the Root Element section, select ...

Get Android™ How to Program, Second Edition 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.