Documente Academic
Documente Profesional
Documente Cultură
By Jeff Friesen
JavaWorld |
AUG 23, 2016 12:28 PM PT
Page 2 of 2
Listing 3. strings.xml
Save strings.xml
In your project window, the values sub-branch of the res sub-branch includes a
strings.xml sub-branch. Double-click this sub-branch to show the strings.xml tab,
then replace its contents with Listing 3 and save the changes.
<animation-list xmlns:android="http://schemas.android.com/apk/res/and
roid"
android:oneshot="true">
<item android:drawable="@drawable/android0" android:duration="500"
/>
<item android:drawable="@drawable/android1" android:duration="500"
/>
<item android:drawable="@drawable/android2" android:duration="500"
/>
<item android:drawable="@drawable/android0" android:duration="500"
/>
</animation-list>
Save animate.xml
In the project window, right-click the drawable sub-branch of the res sub-branch.
Figure 3 shows the resulting pop-up menu.
Sign In | Register
Select New from the pop-up menu, followed by File. Figure 4 shows the resulting
New File dialog box.
Sign In | Register
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 android0.png, android1.png, and 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.
Follow
Page 2 of 2
Copyright © 2018 IDG Communications, Inc.
Sign In | Register