You could modify the existing splash.xml layout, but it is sometimes easier to start from scratch by using the Eclipse layout resource editor to remove all existing controls. You then take the following steps to generate the layout you want, based on your intended layout design:
1. Begin by adding a new LinearLayout control and setting its background attribute to @android:color/black and its orientation to vertical. All subsequent controls will be added inside the LinearLayout control. It's often easiest to use the Outline view of Eclipse to add View controls within one another or move them around.
2. Add a TextView control called TextViewTopTitle. Set layout_width to fill_parent and layout_height to wrap_content. Set the control's text attribute to the string resource, its textColor attribute to the yellow color resource, and its textSize to the dimension resource you created.
3. Add a TableLayout control called TableLayout01. Set layout_width to fill_parent and layout_height to wrap_content. Also, set the stretchColumns attribute to *, to stretch any column, as necessary, to fit the screen.
Because you will be setting the overall background color of the splash screen to black, you do not need to create a special resource. Instead, you just use the built-in Android resource @android:color/black.
4. Within the TableLayout control add a TableRow control. Within the TableRow control add two ImageView controls. For the first ImageView control, set the src attribute to the splash1.png drawable resource @drawable/splash1. Add a second ImageView control and set its src attribute to the splash2.png resource file.
5. Repeat step 4, creating a second TableRow control. Again, add ImageView controls for splash3.png and splash4.png.
6. Much as in step 2, add another TextView control called TextViewBottomTitle within the parent LinearLayout. Set its layout_width attribute to fill_par-ent and layout_height to wrap_content. Set its text attribute to the appropriate string, its textColor attribute to the yellow color, and its textSize attribute to the dimension resource you created.
7. For the version information, create one last TextView control, called TextViewBottomVersion. Set its layout_width attribute to fill_parent and layout_height to fill_parent. Set its text attribute to the appropriate string, its textColor attribute to the grayish color, and its textSize attribute to the dimension resource you created earlier. Also, set its background attribute to the color resource (dark blue) and lineSpacingExtra to the spacing dimension resource value you created.
8. Tweak the layout_gravity and gravity settings on the various controls until you think the layout looks reasonable in the Eclipse resource editor preview.
At this point, save the splash.xml layout file and run the Been There, Done That! application in the Android emulator. The Splash screen should look as shown in Figure 7.3.
You could stop here, except that your splash screen still lacks pizzazz. Also, you need some way to transition from the splash screen to the main menu screen.
The Been There, Done That! splash screen.
Been There, Done ThatI
Copyright C2010 Marrilambo, Inc. All Rights Reserved
Was this article helpful?