Linking back to the main menu
Finally, for this layout, we will add a button that links back to the menu, as follows:
- Add another
TableRowvia the Component Tree. - Drag a button onto the new
TableRow. - Edit its
layout_columnattribute to1so that it is in the middle of the row. - Edit its
textattribute toMenuand edit itsonClickattribute to match our already existingloadMenuLayoutmethod.
You can now run the app and switch back and forth between the different layouts.
If you want to, you can add some meaningful titles and data to the table by editing all the text attributes of the TextView, as I have done in the following screenshot, which shows the TableLayout running in the emulator:
Figure 4.35 – Adding some significant titles and data to the table by editing all the text attributes of the TextView
Note
The author admits that the preceding data might be considered overly optimistic.
As a final thought, think...