FrameAnimation Frame Animation
Note: outofmemory7.8 images)
Optimization Method: Separate the dynamic part from the static part, and perform static background and dynamic animation.
Procedure:
1. The artist makes a single frame animation.
2. Create an xml file, set resouse type to drawble, and the root element to animation_list.
<Item android: drawable = "@ drawable/angela_blink_0001" android: duration = "100"/>
Define the image and interval
Android: oneshot = "true" Single Cycle
<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:drawable="@drawable/angela_blink_0001" android:duration="100"/> <item android:drawable="@drawable/angela_blink_0002" android:duration="100"/> <item android:drawable="@drawable/angela_blink_0003" android:duration="100"/> <item android:drawable="@drawable/angela_blink_0004" android:duration="100"/> <item android:drawable="@drawable/angela_blink_0005" android:duration="100"/> <item android:drawable="@drawable/angela_blink_0006" android:duration="100"/> </animation-list>
3. The Code is as follows:
ImageView imageView = (ImageView) findViewById(R.id.imageView1); final AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getDrawable()
Play the animation. start ();
Stop animation. stop ();
This article is from the "wangcuijing" blog, please be sure to keep this source http://wangcuijing.blog.51cto.com/7233352/1286573