animated GIF animation in Android general support is not very good, so found an open source project, is briefly described as follows:
Gifview is an item that is designed to solve the problem in Android that does not now display GIF directly, only through Mediaplay, with the same usage as ImageView, which supports GIF images
question: There is an estimated problem of oom, please think about how to avoid oom. How to use:1-Add Gifview.jar to your project. 2-Configure the basic properties of Gifview in XML, Gifview inherits from the view class, and button, ImageView, is a UI control. such as:<com.ant.liao.gifview android:id= "@+id/gif2"
android:layout_height= "Wrap_content" android:layout_width= "Wrap_content"
android:paddingtop= "4px" android:paddingleft= "14px" android:enabled= "false"/> 3-Configure common properties in your code: //Get Gifview handle from XML
GF1 = (Gifview) Findviewbyid (R.ID.GIF1);
Set up a GIF picture source
Gf1.setgifimage (R.DRAWABLE.GIF1);
Add Listener
Gf1.setonclicklistener (this);
Set the size of the display, stretch or compress
Gf1.setshowdimension (300, 300);
Set Load mode: First loaded and then displayed: Gifimagetype.Wait_finish, Side loading edge display:Gifimagetype.Sync_decoder, only the first frame is displayed again:Gifimagetype.COVERGf1.setgifimagetype (gifimagetype.cover);
There are four classes of Gifview jar packages : Gifaction.java Observer class to monitor whether GIF was loaded successfully
Gifframe.java inside three members: current picture, delay, the next frame link.
Gifdecoder.java Decoding Thread classes
Gifview.java main class, including common methods, such as Gifview construction method, setting up picture source, delay, drawing, etc.
Note: Reprint to: Http://www.oschina.net/p/gifview
Annex demo+ Source code:
gifviewdemo.rar (799.31 kb, downloads: 586) src.rar (9.21 kb, download count: 260)
Improved:
1.GifView how to control the playback speed of GIF? --"modified the Systemclock.sleep in Drawthread (10);
Android Display GIF animated Gifview