Android中帧动画的创建
帧动画,实质上就是快速播放多张连接效果的图片,现在一般可用于下拉刷新时候的headView
实现步骤:
1、首先应该准备一组连接效果的图片

2、在res>drawable目录下创建xml文件,将图片对象添加到集合naimation-list
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_01"
android:duration="200"/>
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_02"
android:duration="200"/>
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_03"
android:duration="200"/>
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_04"
android:duration="200"/>
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_05"
android:duration="200"/>
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_06"
android:duration="200"/>
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_07"
android:duration="200"/>
<item android:drawable="@mipmap/bga_refresh_mt_refreshing_08"
android:duration="200"/>
</animation-list>
注意: android:oneshot="false" 设置false表示可以循环播放 设置true表示只播放一次
3、加载进ImageView背景进行播放
final ImageView image= (ImageView) findViewById(R.id.image);
image.setBackground(R.drawable.refresh);
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AnimationDrawable animationDrawable= (AnimationDrawable) image.getBackground();
animationDrawable.start();// 开启动画
}
});
Android中帧动画的创建的更多相关文章
- 帧动画的创建方式 - xml方式
废话不多说,先看东西 创建帧动画1 - xml方式 帧动画的创建方式主要以下2种: * 用xml创建动画: * 用代码创建动画: 本文内容主要关注 xml文件 创建帧动画的方式 xml文件 ...
- Android中矢量动画
Android中矢量动画 Android中用<path> 标签来创建SVG,就好比控制着一支画笔,从一点到一点,动一条线. <path> 标签 支持一下属性 M = (Mx, ...
- Android中的动画
Android中的动画分为: 1.逐帧动画(Frame Animation): 把动画过程的每张静态图片都收集起来,然后由Android来控制依次显示这些静态图片,然后利用人眼”视觉暂留“的原理,给 ...
- Android中的动画具体解释系列【4】——Activity之间切换动画
前面介绍了Android中的逐帧动画和补间动画,并实现了简单的自己定义动画.这一篇我们来看看怎样将Android中的动画运用到实际开发中的一个场景--Activity之间跳转动画. 一.定义动画资源 ...
- Android 自定义帧动画
Android 自定义帧动画 Android L : Android Studio 帧动画 和gif图片类似,顺序播放准本好的图片文件:图片资源在xml文件中配置好 将图片按照预定的顺序一张张切换,即 ...
- Android 杂谈---帧动画
Android中的动画有 帧动画 属性动画 补间动画 大体思路 1.需要定义存放每一帧的xml文件,放在drawable文件夹下 设置图片路径和duration,以及shot属性,false---&g ...
- Android使用帧动画内存溢出解决方法
Android使用帧动画内存溢出解决方法https://blog.csdn.net/daitu_liang/article/details/52336015https://blog.csdn.net/ ...
- cocos2dx2.0 帧动画的创建和播放过程 深入分析
一.帧动画的创建过程帧动画的实现有四个不可或缺的类,如下:1.CCSpriteFrame:精灵帧信息.存储帧动画的每一帧的纹理基本信息. class CC_DLL CCSpriteFrame : pu ...
- Android中的动画详解系列【4】——Activity之间切换动画
前面介绍了Android中的逐帧动画和补间动画,并实现了简单的自定义动画,这一篇我们来看看如何将Android中的动画运用到实际开发中的一个场景--Activity之间跳转动画. 一.定义动画资源 如 ...
随机推荐
- 用curl访问HTTPS站点并登录
开发网站,少不了测试.现在的网站为了加强安全性,都启用了HTTPS协议.所谓HTTPS,也就是HTTP文本在SSL协议中传输.用curl命令行来测试HTTPS站点是个很有用的功能,写点脚本,就可以做功 ...
- 给你的git仓库瘦身
很久没有写博客了,最近遇到了一个git问题,比较典型,记录下来与大家分享. 我们使用git版本控制的时候享受了很多便利,不管是代码合并,分支提供给我们的并发,但我们也往往忽略了每次提交之后在我们本地项 ...
- linux下测试宽带速度
speedtest-cli是一个用Python编写的轻量级Linux命令行工具,在Python2.4至3.4版本下均可运行.它基于Speedtest.net的基础架构来测量网络的上/下行速率.安装sp ...
- android 在5.0以后不允许使用隐式Intent方式来启动Service
android5.0以后不能使用隐式intent :需要指定Intent的ComponentName信息:intent.setComponent(xxx),或指定Intent的setPackage(& ...
- 关于angularjs的$state.go()与ui-sref传参问题
上次转发过关于angularjs回退的文章,回退用到的还是js的回退功能,直接用history.back();实现功能,当时顺便提了下$state.go()有关路由跳转. 那这回就全面解析下$stat ...
- ActiveMQ的简单例子应用
ActiveMQ是一种消息中间件,它实现了JMS规范,提供点对点和订阅-发布两种模式.下面介绍下ActiveMQ的使用: 一.环境的搭建 首先我们需要下载ActiveMQ的安装包,下载地址http:/ ...
- Nexpose
下载: https://www.rapid7.com/products/nexpose/nexpose-enterprise-trial-thank-you.jsp注册: https://www.ra ...
- 【LeetCode】30. Substring with Concatenation of All Words
You are given a string, s, and a list of words, words, that are all of the same length. Find all sta ...
- 本地存储 cookie,session,localstorage( 一)基本概念及原生API
http://www.w3school.com.cn/html5/html_5_webstorage.asp http://adamed.iteye.com/blog/1698740 localSto ...
- Android中AlertDialog对话框禁止按[返回键]或[搜索键]
alertDialog.setOnKeyListener(new DialogInterface.OnKeyListener() { @Override public boolean onKey(Di ...