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;@Overrideprotected 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() {@Overridepublic void onClick(View v) {System.out.println(" Click ");}});mGifView.setShowDimension(300, 300);//加载方式mGifView.setGifImageType(GifImageType.COVER);}}


main.xml如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    >    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="@string/hello_world"        android:layout_centerHorizontal="true" />        <com.ant.liao.GifView        android:id="@+id/gifView"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:enabled="false"        android:layout_centerInParent="true" /></RelativeLayout>


更多相关文章

  1. Eclipse 开发 Android, Hello FormStuff(学习9)
  2. Android控件属性android:fitsSystemWindows="true"的坑
  3. 解决Cocos2d-x3.1编译生成Android程序出现Android(安卓)NDK:Abor
  4. 实现类似Android联系人搜索功能
  5. Android(安卓)JNI入门第一篇――HelloWord
  6. app:preDebugAndroidTestBuild
  7. Android下拉框控件Spinner的使用
  8. Android(安卓)之 LayoutInflater
  9. Android(安卓)控件随意拖动

随机推荐

  1. 《尚硅谷Dubbo视频教程》免费下载
  2. 朋友圈新增“用微视拍摄”功能,腾讯微信微
  3. 大规模邻域搜索(LNS)求解带时间窗的车辆路
  4. 尚硅谷大数据视频_Shell视频教程免费下载
  5. 《尚硅谷韩顺平Go语言核心编程》全套视频
  6. 看图说话,脏读、不可重复读、幻读分别是什
  7. [DM]聚类
  8. 浮动(License)许可使用紧张优化方案
  9. 请将你的 if else 设计成责任链模式!
  10. 通过代码原理教你搞懂SGD随机梯度下降、B