6.4.3. fragment_game.xml
The fragment_game.xml
layout for the CannonGameFragment
contains a FrameLayout
that displays the CannonView
. A FrameLayout is designed to display only one View
—in this case, the CannonView
. In this section, you’ll create CannonGameFragment
’s layout and the CannonView
class. To add the fragment_game.xml
layout, perform the following steps:
1. Expand the project’s res/layout
node in the Package Explorer.
2. Right click the layout
folder and select New > Android XML File to display the New Android XML File dialog.
3. In the dialog’s File field, enter fragment_game.xml
4. In the Root Element section, select FrameLayout, then click Finish.
5. From the Palette’s Advanced section, drag a view (with a lowercase v) onto the design ...
Get Android™ How to Program, Second Edition 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.