Detailed explanation of playback control and monitoring of GIF motion chart in Android

preface

The project that I took over recently involves the playback and monitoring of GIF motion pictures. In the previous version, the GIF processing was implemented by H5. Considering the user experience, the current demand is to turn this child into an original child, which almost went astray on the way! Let's take a look at the detailed introduction.

Gif dynamic graph processing and monitoring in Android

The first thing I thought of at the beginning was glide, but I thought glide could not control GIF and monitor it, so I searched the Internet for other methods. I see that there is a scheme to divide the pictures into frames and use frame by frame animation one by one.

I began to doubt the people who gave this solution. What is the era when they still do such thankless things that occupy a lot of user memory! So I googled carefully before I started. The answer really embarrassed me. Glide can control GIF animation!!!

Code above: use glide to load GIF animation

A very simple line of code can be done. Pictures and moving pictures can be loaded in the above ways (network links can also be used)

The following is the writing method of GIF dynamic graph that can only be loaded:

In fact, there is an asgif

But in this way, the moving picture playback is always cyclic. What way can you stop it! Never met. Don't say it's unnecessary. If there is a demand now, you need to click the button to play GIF once to realize the interaction with users? I think you must get this skill, because you will meet similar needs sooner or later!

The following writing method realizes the control of GIF dynamic graph

Using this method can perfectly realize the control of GIF and provide benign support for the needs I encounter!

summary

The above is the whole content of this article. I hope the content of this article can bring some help to Android developers. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>