Android 动画具体解释Frame动画 (Drawable Animation)
Frame动画像gif画画,通过一些静态的图片,以实现动画效果。
Android sdk该AnimationDrawable就是专门针对Frame动画,当然Frame动画也可在java代码或者xml中写,可是提倡大家还是在xml中写,先上个效果图。
<span style="font-size:18px;"><?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" > <item
android:drawable="@drawable/market_loading_01"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_02"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_03"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_04"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_05"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_06"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_07"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_08"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_09"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_10"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_11"
android:duration="100"/>
<item
android:drawable="@drawable/market_loading_12"
android:duration="100"/> </animation-list></span>
Frame动画在xml中的根节点是<animation-list>当中的oneshot=false是循环播放,为true的话则播放到最后一张图片就会停止播放,在java中调用
ImageView imageView;
AnimationDrawable animationDrawable; protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView) findViewById(R.id.image);
imageView.setBackgroundResource(R.drawable.drawable_progress);
animationDrawable = (AnimationDrawable) imageView.getBackground();
animationDrawable.start();
由于Frame 动画是有一堆静态图构成的所以,能够当成background。
用java代码写的话
AnimationDrawable animationDrawable2 = new AnimationDrawable();
Drawable drawable = getResources().getDrawable(R.drawable.fengjing_1);
Drawable drawable2 = getResources().getDrawable(R.drawable.fengjing_2);
Drawable drawable3 = getResources().getDrawable(R.drawable.fengjing_3);
animationDrawable2.addFrame(drawable, 1000);
animationDrawable2.addFrame(drawable2, 1000);
animationDrawable2.addFrame(drawable3, 1000);
animationDrawable2.setOneShot(false);
imageView.setBackgroundDrawable(animationDrawable2);
animationDrawable2.start();
恩。。就是这样了,Frame 动画了解到这已经差点儿相同了。
版权声明:本文博客原创文章,博客,未经同意,不得转载。
Android 动画具体解释Frame动画 (Drawable Animation)的更多相关文章
- Android动画主要包含补间动画(Tween)View Animation、帧动画(Frame)Drawable Animation、以及属性动画Property Animation
程序运行效果图: Android动画主要包含补间动画(Tween)View Animation.帧动画(Frame)Drawable Animation.以及属性动画Property Animatio ...
- Android图文具体解释属性动画
Android中的动画分为视图动画(View Animation).属性动画(Property Animation)以及Drawable动画.从Android 3.0(API Level 11)開始. ...
- Android 动画具体解释View动画
为了让用户更舒适的在某些情况下,利用动画是那么非常有必要的.Android在3.0一旦支持两种动画Tween动漫Frame动画.Tween动画支持简单的平移,缩放,旋转,渐变.Frame动画就像Gif ...
- android动画具体解释四 创建动画
使用ValueAnimator进行动画 通过指定一些int, float或color等类型的值的集合.ValueAnimator 使你能够对这些类型的值进行动画.你需通过调用ValueAnimator ...
- android动画具体解释二 属性动画原理
property动画是一个强大的框架,它差点儿能使你动画不论什么东西. 你能够定义一个动画来改变对象的不论什么属性,不论其是否被绘制于屏幕之上. 一个属性动画在一定时间内多次改变一个属性(对象的一个字 ...
- 动画_ _ Android应用开发之所有动画使用详解
转载: http://blog.csdn.net/yanbober/article/details/46481171 题外话:有段时间没有更新博客了,这篇文章也是之前写了一半一直放在草稿箱,今天抽空把 ...
- Android应用开发之所有动画使用详解
题外话:有段时间没有更新博客了,这篇文章也是之前写了一半一直放在草稿箱,今天抽空把剩余的补上的.消失的这段时间真的好忙,节奏一下子有些适应不过来,早晨七点四十就得醒来,晚上九点四十才准备下班,好像最近 ...
- Android animation学习笔记之view/drawable animation
前一章中总结了android animation中property animation的知识和用法,这一章总结View animation和Drawable animation的有关知识: View ...
- Android动画总结#补间动画(Tween Animation/View Animation) #帧动画(Frame Animation/Drawable Animation)#属性动画(PropertyAnimation)
1.共有三种动画,英文名字多种叫法如下 第一种动画:补间动画(Tween Animation/View Animation) 四个:RotateAnimation旋转. AlphaAnimation透 ...
随机推荐
- 美国汪利宏的蒙特卡洛及卷积模拟程序,可以模拟top-hat光束和高斯光束在生物组织中的传输
链接:https://pan.baidu.com/s/1yaCsQ8TCVPSIZ4TVBZgfnw 密码:otzr
- Xcode5新特性之注释
Xcode5新特性之注释 Xcode5在注释式文档方面也有进步,越来越象javadoc. Xcode4 参考一下教程 http://blog.chukong-inc.com/index.php/201 ...
- PHP中出现BOM字符\ufeff,PHP去掉诡异的BOM \ufeff
研究一个PHP项目的时候,今天项目突然打不开了. 前几天还好好的,用Chrome看了下Response的内容,AJAX页面和普通HTML页面内容前面有一个红色的点. 鼠标移上去,提示"\uf ...
- Intent七大属性之总结 分类: H1_ANDROID 2013-11-10 09:41 1074人阅读 评论(0) 收藏
参考<疯狂android讲义>第5章 1.Intent 用于封装程序的"调用意图",不管想启动一个Acitivity.Service还是BroadcastReceive ...
- [Grid Layout] Use the minmax function to specify dynamically-sized tracks
Using minmax() is an amazingly useful way to specify boundaries for the smallest and largest size a ...
- [Ramda] Declaratively Map Data Transformations to Object Properties Using Ramda evolve
We don't always control the data we need in our applications, and that means we often find ourselves ...
- js进阶 9-15 多选框如何限制选中数目
js进阶 9-15 多选框如何限制选中数目 一.总结 一句话总结: 1.多选框如何限制选中数目? 没点击选择一次,来统计现在总共选了多少个,如果超出,就给onclick事件返回false,取消oncl ...
- 在向server发送请求时发生传输级错误。 (provider: 共享内存提供程序, error: 0 - 管道的还有一端上无不论什么进程。
作者:卿笃军 原文地址:http://blog.csdn.net/qingdujun/article/details/36425825 SQL Server 2008 + VS2010 用C#编写的代 ...
- ts demuxer的加入记录
文件夹 1 初衷 2 ts demux的功能介绍 1 初衷 之前打算给dtplayer加入一些亮点功能,最初的想法是:bt下载播放 + hls支持 bt下载因为以来libtorrent库,尽管搞懂了怎 ...
- WPF 在绘图控件(Shape)中添加文字 [2018.7.15]
原文:WPF 在绘图控件(Shape)中添加文字 [2018.7.15] Q:使用Shape的子类Ellipse画一个圆,如何在圆中添加文字? A:Shape类中不包含Text属性.可使用Shape类 ...