Updating the Settings Screen Layout

The settings.xml layout file dictates the user interface of the settings screen. Again, you open the Eclipse layout resource editor and remove all existing controls from the layout. You then follow these steps to generate the layout you want, based on your earlier design:

1. Add the customary LinearLayout control, with its background attribute set to @drawable/bkgrnd. All subsequent controls will be added inside the LinearLayout control.

2. Add the same title bar controls you've added to other screens.

3. Below the title bar, add a ScrollView control to encapsulate your settings. Set its isScrollContainer attribute to true and its scrollbars attribute to vertical. Set its layout_width and layout_height attributes to fill_parent.

4. Within the ScrollView control, add a LinearLayout control to encapsulate your settings. Set its orientation attribute to vertical. Set its layout_width and layout_height attributes to fill_parent. All subsequent controls will be added within this LinearLayout control.

5. Within the LinearLayout control, add a TextView control to display the Nickname label text. Below the TextView control for the label, add an EditText control. Set its id attribute to EditText_Nickname, its maxLength attribute to 20, its maxLines attribute to 1, and its inputType attribute to textPersonName.

6. Add a TextView control to display the Email label text. Then add another EditText control below it, setting its id attribute to EditText_Email, its maxLines attribute to 1, and its inputType attribute to textEmailAddress.

7. Add the Password settings region of the form by adding another TextView control to display the Password label text. Below it, add a horizontal LinearLayout control with two controls: a Button control and a TextView control. Configure the Button control with the id attribute Button_Password and the text attribute set to the Password button text string resource. Configure the TextView control to display the Password setting state string ("Password not set", for now).

8. At the same level as the Password setting region, add a region for the Date of Birth setting. Start by adding another TextView control to display the Date of Birth label text. Next, add another horizontal LinearLayout control with two controls: a Button control and a TextView control. Configure the Button control with the id attribute Button_DOB and the text attribute set to the Date of Birth button text string resource. Configure the TextView control to display the Date of Birth setting state string ("Date not set", for now).

9. Add one last settings region for the Gender drop-down by adding a TextView control to display the Gender label text. Then add a Spinner control and set its id attribute to Spinner_Gender.

10. Before saving, adjust any text sizes, fonts, colors, height, or width settings until the screen draws as desired.

At this point, save the settings.xml layout file.

0 0

Post a comment