Adding the Tab Host Control

To add tabbing support to the scores screen, you include a TabHost control, which is a container with child tabs, each of which may contain some layout content. TabHost is a somewhat complex control. In order to configure it within an XML layout file, you need to follow a set of guidelines:

► Include a TabHost control

► Ensure that there is a LinearLayout within the TabHost control

► Ensure that there is a specially named TabWidget control and FrameLayout control within the LinearLayout control

► Define the contents of each tab in the FrameLayout control

Figure 9.5 shows the layout design for the scores screen.

LinearLayout (Vertical Orientation)

RelativeLayout

ImageView

TextView (Title)

ImageView

TabHost

LinearLayout TabWidget

FrameLayout

TableLayout (TableLayout_AllScores) TableRow (Header)

TableRow (One for each score)

TableLayout (TableLayout_FriendScores)

TableRow (Header)

TableRow (One for each score)

Layout design for the Been There, Done That! scores screen.

0 0

Post a comment