5.4.11. Creating the Flag Shake Animation

In this section, you’ll create the animation that shakes the flag when the user guesses incorrectly. We’ll show how this animation is used by the app in Section 5.6.9. To create the animation:

1. Right click the project’s res folder, then select New > Folder, in the Folder name field enter anim and click Finish.

2. Right click the anim folder, then select New > Android XML File to display the New Android XML File dialog.

3. In the File text field, enter the name incorrect_shake.xml.

4. Ensure that the Resource Type is Tween Animation and the Root Element is set.

5. Click Finish to create the file. The file opens immediately in XML view.

6. Unfortunately, the IDE does not provide an editor for animations, ...

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.