Nested inside the
animation-list element is a sequence of
item elements. Each
item element identifies one drawable in the animation sequence via its
drawable attribute. The
@drawable/androidx resource reference (where
x ranges from
2) identifies an image file whose name starts with
duration attribute identifies the number of milliseconds that must elapse before the next
item element's drawable is displayed.
In the project window, right-click the drawable sub-branch of the res sub-branch. Figure 3 shows the resulting pop-up menu.
Figure 3. Add android_animate.xml as a new drawable resource
Select New from the pop-up menu, followed by File. Figure 4 shows the resulting New File dialog box.
Figure 4. Enter android_animate.xml
Type android_animate.xml into the "Enter a new file name" text field and click OK. (You'll see an android_animate.xml sub-branch under the drawable sub-branch.) Then, replace the contents of the resulting android_animate.xml tab with the code from Listing 4 and save your changes.
You'll also need to copy the
android2.png files (referenced in Listing 4) from the code source associated with this article to the drawable branch. Assuming you're working in Windows, select these files from Windows Explorer and paste them into this branch (right-click the branch name and select Paste).
Conclusion to Part 2
Now that you understand W2A's architecture and have learned how to code a simple animated mobile app in Android Studio, you're ready to build and run your app. Turn to Part 3 when you're ready for this final step.
Sign up for CIO Asia eNewsletters.