Adding New Project Resources

Now that you have your layout designed, you need to create the drawable, string, color, and dimension resources you will use in the layouts used by the main menu screen.

You begin by adding four new graphic resources to the /res/drawable directory: bkgrnd.jpg, divider.png, half.png, and textured.png. LinearLayout will use the bkgrnd.jpg graphic file as the background image. The ListView control will use the divider.png and textured.png graphics for the custom divider and selector, respectively. The ImageView control will use the half.png graphic at the bottom of the screen.

You continue by adding and modifying several new strings in the /res/values/strings.xml resource file so that you have a string for each menu option, as well as one for the title TextView control.

Finally, update the color resources in /res/menu/colors.xml to include colors for the screen title TextView attributes as well as the TextView items displayed within the ListView. You should also update the resources in /res/values/dimens.xml to include dimensions for the title text and the ListView item text.

For specific resource configurations, you can use the values provided in the book source code as a guide, or configure your own custom values.

After you have saved the resource files, you can begin to use them in the layout resource files used by the main menu screen.

0 0

Post a comment