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
TableRow
via the Component Tree. - Drag a button onto the new
TableRow
. - Edit its
layout_column
attribute to1
so that it is in the middle of the row. - Edit its
text
attribute toMenu
and edit itsonClick
attribute to match our already existingloadMenuLayout
method.
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:
Note
The author admits that the preceding data might be considered overly optimistic.
As a final thought, think...