Exercise: Flick

The app Flick (see Figure 5.9) creates a ball that can be flicked across the screen or moved by shaking the phone.

Image

Figure 5.9 The final product of the app.

1. To begin, open a new project and name it Flick.

2. Drag out a canvas. We then want it to fill the screen, so change the width and height on the canvas to Fill Parent. This tells the canvas to take up all the available space in the app.

3. Drag out a ball. Drop it into the canvas; ball components can be placed only in a canvas. To make it a little easier to see and flick, change the size by making the Radius 10 (see Figure 5.10).

Figure 5.10 The Radius adjusts the speed ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps 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.