Android Open Source project: gifview--android Display gif animations

Source: Internet
Author: User

Download: http://code.google.com/p/gifview/downloads/list

Introduction: Android now does not directly display GIF view, only through the mediaplay to display, and often do not display properly, for this gifview, the use of the same as ImageView

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 gif picture source   Gf1.setgifimage (R.DRAWABLE.GIF1);  //  add listener  Gf1.setonclicklistener      (this  );     //  Set the displayed size, stretch, or compress  Gf1.setshowdimension (300 , );   //  set Load mode: Display first, edge load edge display, show first frame only   Gf1.setgifimagetype (Gifimagetype.cover); 

There are four classes of Gifview jar packages:

Gifaction.java:

Observer class to monitor whether GIF was loaded successfully

Package Com.ant.liao;      Public Interface gifaction {  /* *   *gif decode Viewer   * @hide   * @param parsestatus decoding is successful, the success will be true              * @param frameindex The current decoding of the first few frames, when all decoded successfully, here is-              1 */        Public void Parseok (boolean parsestatus,int frameindex);  }    

There are four classes of Gifview jar packages:

Gifaction.java:

Observer class to monitor whether GIF was loaded successfully

Package Com.ant.liao;      Public Interface gifaction {  /* *   *gif decode Viewer   * @hide   * @param parsestatus decoding is successful, the success will be true              * @param frameindex The current decoding of the first few frames, when all decoded successfully, here is-              1*       /publicvoid Parseok ( Boolean parsestatus,int frameindex);  }    

Gifframe.java

Inside three members: current picture, delay, link to the next frame.

Package Com.ant.liao;  Import Android.graphics.Bitmap;  Public classGifframe {/** * constructor * @param im picture * @param del delay*/           PublicGifframe (Bitmap im,intdel) {Image=im; Delay=del; }              PublicGifframe (String name,intdel) {ImageName=name; Delay=del; }                 /** Picture*/         PublicBitmap image; /** Delay*/           Public intdelay; /** File name when picture is saved*/    PublicString ImageName =NULL; /** Next Frame*/         PublicGifframe NextFrame =NULL; }    

Android Open Source project: gifview--android Display gif animations

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.