Android显示GIF动画完整示例(一)
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如下:
<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>
Android显示GIF动画完整示例(一)的更多相关文章
- Android显示GIF动画完整示例(二)
MainActivity如下: package cc.testgif2; import android.os.Bundle; import android.app.Activity; /** * De ...
- Android显示GIF动画 GifView
android中显示gif动画原生态一般支持的不是很好,故找了一个开源的项目,现简单介绍如下: GifView 是一个为了解决android中现在没有直接显示gif的view,只能通过mediapla ...
- Android显示GIF动画(转载)
GifView 是一个为了解决android中现在没有直接显示gif的view,只能通过mediaplay来显示这个问题的项目,其用法和 ImageView一样,支持gif图片 使用方法: 1-把Gi ...
- Android开源项目:GifView——Android显示GIF动画
下载:http://code.google.com/p/gifview/downloads/list 简介:android中现在没有直接显示gif的view,只能通过mediaplay来显示,且还常常 ...
- Android窗口管理服务WindowManagerService显示窗口动画的原理分析
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8611754 在前一文中,我们分析了Activi ...
- 【Android】21.4 图片动画缩放示例
分类:C#.Android.VS2015: 创建日期:2016-03-21 一.简介 该例子演示如何动画缩放图片,实现类似"点击看大图"的效果. 二.示例 1.运行截图 2. ...
- android应用市场、社区客户端、漫画App、TensorFlow Demo、歌词显示、动画效果等源码
Android精选源码 MVP架构Android应用市场项目 android刻度盘控件源码 Android实现一个社区客户端 android商品详情页上拉查看详情 基于RxJava+Retrofit2 ...
- Android SDK上手指南:示例项目
Android SDK上手指南:示例项目 2013-12-26 15:40 核子可乐译 51CTO 字号:T | T Android SDK示例项目中的应用能够执行种种功能,例如各类用户界面元素.数据 ...
- Android Animation(动画)
前言 Android 平台提供实现动画的解决方案(三种) 一.3.0以前,android支持两种动画: (1)Frame Animation:顺序播放事先做好的图像,与gif图片原理类似,是一种逐帧动 ...
随机推荐
- npm 安装
1.https://nodejs.org/en/ 下载node.js 控制台,查看node版本 C:\WINDOWS\system32>node --version 出现版本表示安装成功 2 ...
- slf4j+log4j配置(Maven)
首先配置Maven依赖 <!-- http://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 --> <dependency& ...
- window.parent与window.opener的区别与使用
window.parent 是iframe页面调用父页面对象 举例: a.html 如果我们需要在b.html中要对a.html中的username文本框赋值(就如很多上传功能,上传功能页在ifrma ...
- cocos2d-x3.9利用cocos引擎一键打包Android平台APK(C++小白教程)
链接地址:http://www.cocoachina.com/bbs/read.php?tid=333937 cocos2d-x3.9利用cocos引擎一键打包Android平台APK(C++小白教程 ...
- 托管服务帐号(Managed Service Account)
托管服务帐号是绑定到单独的机器上,并且仅用于服务所用,所以不能用来登录. 创建托管帐号,不需要指定密码,密码会由活动目录自动管理.并且根据密码策略(默认30天)自动刷新,期间不影响服务. 在创建完之后 ...
- [LeetCode]题解(python):005-Longest Palindromic Substring
题目来源: https://leetcode.com/problems/longest-palindromic-substring/ 题意分析: 这道题目是输入一段不超过1000的字符串,输出最长的回 ...
- 正则语法笔记-regular expression note
参考文档:python正则表达式 正则表达式定义:正则是一门高度专业编程语言,内嵌在其他语言(python re模块)中使用.正则表达式包含元字符(metacharacter)列表,列表如下: . ^ ...
- .net web初级工程师教程
序 这份教程,只针对正在努力找工作的初级.net web工程师,软件这行,刚入门时找工作是个坎,希望教程对各位有帮助. 教程将通过一个实际项目,简单明了地完整呈现,在实际工作中,工程师都做些什么及怎么 ...
- Android开发中怎样调用系统Email发送邮件(多种调用方式)
在Android中调用其他程序进行相关处理,几乎都是使用的Intent,所以,Email也不例外,所谓的调用Email,只是说Email可以接收Intent并做这些事情 我们都知道,在Android中 ...
- HDU2577:How to Type(DP)
Problem Description Pirates have finished developing the typing software. He called Cathy to test hi ...