Display GIF animation (Frame Animation playback) and GIF animation playback

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.