Adding New Project Resources

Now that you have your layout design for the splash screen, you need to create the string, color, and dimension resources to use within the layout.

You begin by adding four new graphic resources to the /res/drawable directory (creating the directory, if necessary): splashl.png, splash2.png, splash3.png, and splash4.png. These graphics will be displayed in the TableLayout control in the center of the splash screen.

The code for this project is available on the book website,

Implementing the Splash Screen Layout

Then you can add three new strings to the /res/values/strings.xml resource file: one for the top title (Been There), one for the bottom title (Done That!), and one for some version information (multiple lines). Technically, you can now remove the splash string because you will no longer be using it.

Next, you create a new resource file called /res/values/colors.xml to contain the three color resources you need: one for the title text color (a golden yellow), one for the version text color (grayish white), and one for the version text background color (deep blue).

Did you Know?

Finally, you need to create some dimension resources in a new resource file called /res/values/dimens.xml. You create three new dimension values: one to control the title font size (24pt), one to control the version text font size (5pt), and one to allow for nice line spacing between the lines of the version text (3pt).

After you have saved the resource files, you can begin to use your new resources in the splash.xml layout resource file.

Was this article helpful?

0 0

Post a comment