Android自助餐之动画(一)帧动画
2016-01-14 21:33
561 查看
Android自助餐之动画(一)帧动画
Android自助餐之动画一帧动画下载完整源代码
准备动画所需图片
编写amin的xml文件
把amin设置到ImageView上
需要开始动画的地方作如下处理
下载完整源代码
准备动画所需图片
此处已准备四张图片放到drawable-xxhdpi下,分别为pic1、pic2、pic3、pic4
编写amin的xml文件
google官方建议这种动画xml放到drawable下管理
[code]<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/pic1" android:duration="200"/> <item android:drawable="@drawable/pic2" android:duration="200"/> <item android:drawable="@drawable/pic3" android:duration="200"/> <item android:drawable="@drawable/pic4" android:duration="200"/> </animation-list>
把amin设置到ImageView上
写到background上,便于在java中获取
[code]<ImageView android:id="@+id/iamge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="@drawable/animation" />
需要开始动画的地方作如下处理
[code]AnimationDrawable animationXml = (AnimationDrawable) image.getBackground(); animationXml.start();
相关文章推荐
- Android SQLLite 的基础操作
- android wearable-Creating Cards and Creating Lists
- Android之TextView
- android wearable-Creating Custom Layouts
- android初接触之service1
- android 获取apk md5值
- Android studio ElasticDownloadView
- Android:30分钟弄明白Touch事件分发机制(转)
- Android应用坐标系统全面详解
- Android mk文件详解
- Android内存泄露情况总结
- Android:TextView添加下划线以及利用intent跳转到一个网页
- 从Java回调机制分析Android动态加载布局过程中出现的IllgalStateException
- android apk 防止反编译技术第二篇-运行时修改Dalvik指令
- android混淆去掉日志
- Android 图片处理之 Fresco
- android出现注: 某些输入文件使用或覆盖了已过时的 API。 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 注: 某些输入文件使用了未经检查或不安全的操作。
- Android 长度单位
- android初接触之activity2
- android控件拖动,移动、解决父布局重绘时控件回到原点