我的Android進階之旅——>Android之動畫之Frame Animation實例

Frame animation

An animation defined in XML that shows a sequence of images in order (like a film).

 

FILE LOCATION:

res/drawable/filename.xml

The filename will be used as the resource ID.

COMPILED RESOURCE DATATYPE:

Resource pointer to an AnimationDrawable.

RESOURCE REFERENCE:

In Java: R.drawable.filename

In XML: @[package:]drawable.filename

SYNTAX:

<?xml version="1.0" encoding="utf-8"?>

<animation-list xmlns:android="https://schemas.android.com/apk/res/android"

    android:oneshot=["true" | "false"] >

    <item

        android:drawable="@[package:]drawable/drawable_resource_name"

        android:duration="integer" />

</animation-list>

ELEMENTS:

<animation-list>

Required. This must be the root element. Contains one or more <item> elements.

attributes:

 

android:oneshot

Boolean. "true" if you want to perform the animation once; "false" to loop the animation.

<item>

A single frame of animation. Must be a child of a <animation-list> element.

attributes:

 

android:drawable

Drawable resource. The drawable to use for this frame.

android:duration

Integer. The duration to show this frame, in milliseconds.

 

發佈留言