Java Reference
In-Depth Information
<item
android:drawable="@drawable/duke7"
an-
droid:duration="100" />
<item
android:drawable="@drawable/duke8"
an-
droid:duration="100" />
<item
android:drawable="@drawable/duke9"
an-
droid:duration="100" />
<item
android:drawable="@drawable/duke0"
an-
droid:duration="100" />
</animation-list>
Listing 12-6 presents the animation list of drawables that are connected to
dukeImage via the
dukeImage.setBackgroundResource(R.drawable.duke_wave); state-
ment.
Note The animation-list element's oneshot attribute determines whether
theanimationwillcycleinaloop(whenthisattributeisassigned "false" )oroccur
only once (when it's assigned "true" ). When "true" is assigned to oneshot ,
youmustinvoke AnimationDrawable() 's stop() methodbeforeits start()
method to generate another oneshot animation sequence.
Nestedinsidethe animation-list elementisasequenceof item elements.Each
item elementidentifiesonedrawableintheanimationsequenceviaits drawable at-
tribute.The @drawable/duke x resourcereference(where x rangesfrom 0 through
9 )identifiesanimagefilewhosenamestartswith duke in res 's drawable directory.
The duration attributeidentifiesthenumberofmillisecondsthatmustelapsebefore
the next item element's drawable is displayed.
Listing 12-7 presents Java7MeetsAndroid 's AndroidManifest.xml file.
Listing 12-7. Describing the Java7MeetAndroid app
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/
res/android"
package="ca.tutortutor.j7ma"
android:versionCode="1"
android:versionName="1.0">
<application
android:label="@string/app_name"
an-
Search WWH ::




Custom Search