Chapter 7. Menus and Dialogs

Now that the game works, it is time to tweak the rest of the UI. When you make an app, the best practice is to use all the standard UI components. Games are different, they should have personality. For this we are going to see how to use custom fonts, buttons, and dialogs.

We will start by making all the fragments of the game use a custom font. Then we will tweak the main menu to make it look nicer by adding a background and customizing the buttons for sound and music; we will also customize the button that starts the game using special drawable types we can define in XML.

For GameFragment, we will make space to display the score and lives and will update the pause button as well. We will make the game take care of scoring ...

Get Android Game Programming: A Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.