Display GIF animation (Frame Animation playback) and GIF animation playback
It is not convenient to display gif images on android. Although some controls can be implemented, the effect is not very good. It is safe to use frame animation for processing.
① Define animation-list in XML:
<? Xml version = "1.0" encoding = "UTF-8"?>
<Animation-list xmlns: android = "http://schemas.android.com/apk/res/android" android: oneshot = "false">
<Item android: drawable = "@ drawable/f_1" android: duration = "30"/>
<Item android: drawable = "@ drawable/f_2" android: duration = "30"/>
<Item android: drawable = "@ drawable/f_3" android: duration = "30"/>
<Item android: drawable = "@ drawable/f_4" android: duration = "30"/>
</Animation-list>
② Define the ImageView in the XML layout and specify its src or background attribute as "@ anim/loading"
③ In java code:
ImageView imageView = (ImageView) findViewById (R. id. frame );
AnimationDrawable drawable = (AnimationDrawable) imageView. getDrawable ();
// When using the background attribute
// AnimationDrawable drawable = (AnimationDrawable) imageView. getBackground ();
Drawable. setOneShot (false); // Replay
④ Called in java code:
Drawable. start () or drawable. stop () to play and stop an animation.
This is a GIF animation when PHOTOSHOP opens a dynamic image. You can view only one frame.
The PS itself does not support gif editing. Only related plug-ins are required.
You can try to use FW to edit gif or flash files.
Answer: 1. If you want to edit GIF files, we recommend you use FW (firework) or flash.
2. If it is PS, you cannot use the text tool to modify the gif image. You can cut down the gif image and create a new layer. However, the image is changed to an image.
If you really want to use PS to edit GIF, you can go to Baidu to search for the PS plug-in that supports editing GIF to help you.
But to be honest, PS is really not suitable for GIF animation.
Why do I prompt that only one frame can be displayed when I open GIF animation with PS?
When you use a few points to open GIF animation, it will prompt you to open only one frame, because ps is a plane production tool rather than a GIF animation production tool;
If you want to see all GIF animation frames, you must use a dedicated GIF animation tool. Note that the tools used for GIF animation are different, if you do not need to open the tool during production, you may not be able to see the effect after opening it.
References: Experience