MainActivity如下:
package cc.testgif;import com.ant.liao.GifView;import com.ant.liao.GifView.GifImageType;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.app.Activity;/** * Demo描述: * 利用第三方控件显示GIF动画 * * 参考资料: * http://blog.csdn.net/leilu2008/article/details/6822517# * http://code.google.com/p/gifview/source/checkout * Thank you very much */public class MainActivity extends Activity { private GifView mGifView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); init(); } private void init(){ mGifView = (GifView) findViewById(R.id.gifView); mGifView.setGifImage(R.drawable.gif); mGifView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { System.out.println(" Click "); } }); mGifView.setShowDimension(300, 300); //加载方式 mGifView.setGifImageType(GifImageType.COVER); }}
main.xml如下: