- 浏览: 274410 次
- 性别:
- 来自: 深圳
-
文章分类
最新评论
-
tonytony3:
THANK YOU
Android多级树形菜单的实现 -
haiyang08101:
deleteNumber = "421f481e-7 ...
java对xml文件做增删改查 -
求求你帮帮我:
怎么把我的空格也当成节点处理了?
java对xml文件做增删改查 -
求求你帮帮我:
deleteNumber = "421f481e-7 ...
java对xml文件做增删改查 -
lpj13579:
多谢分享,学习学习
高仿小米盒子UI效果实现
android 逐帧动画 研究了一下下,超简单。一步步按照我流程来弄!
创建一个android项目test.
一:在res创建一个anim文件夹,该文件夹下创建firefox_animation.xml文件
代码如下
<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:duration="300" android:drawable="@drawable/sound_2" /> <item android:duration="300" android:drawable="@drawable/sound_3" /> <item android:duration="300" android:drawable="@drawable/sound_4" /> <item android:duration="300" android:drawable="@drawable/sound_5" /> <item android:duration="300" android:drawable="@drawable/sound_6" /> <item android:duration="300" android:drawable="@drawable/sound_7" /> <item android:duration="300" android:drawable="@drawable/sound_8" /> <item android:duration="300" android:drawable="@drawable/sound_9" /> <item android:duration="300" android:drawable="@drawable/sound_10" /> <item android:duration="300" android:drawable="@drawable/sound_11" /> <item android:duration="300" android:drawable="@drawable/sound_12" /> <item android:duration="300" android:drawable="@drawable/sound_13" /> <item android:duration="300" android:drawable="@drawable/sound_14" /> <item android:duration="300" android:drawable="@drawable/sound_15" /> <item android:duration="300" android:drawable="@drawable/sound_16" /> <item android:duration="300" android:drawable="@drawable/sound_17" /> <item android:duration="300" android:drawable="@drawable/sound_18" /> <item android:duration="300" android:drawable="@drawable/sound_19" /> <item android:duration="300" android:drawable="@drawable/sound_20" /> <item android:duration="300" android:drawable="@drawable/sound_21" /> <item android:duration="300" android:drawable="@drawable/sound_22" /> <item android:duration="300" android:drawable="@drawable/sound_23" /> <item android:duration="300" android:drawable="@drawable/sound_24" /> <item android:duration="300" android:drawable="@drawable/sound_25" /> <item android:duration="300" android:drawable="@drawable/sound_26" /> <item android:duration="300" android:drawable="@drawable/sound_27" /> <item android:duration="300" android:drawable="@drawable/sound_28" /> <item android:duration="300" android:drawable="@drawable/sound_29" /> <item android:duration="300" android:drawable="@drawable/sound_30" /> <item android:duration="300" android:drawable="@drawable/sound_31" /> <item android:duration="300" android:drawable="@drawable/sound_32" /> </animation-list>
二:在main.xml代码如下
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:id="@+id/imageview1" android:layout_width="100px" android:layout_height="100px" android:src="@anim/firefox_animation"> </ImageView> <Button android:id="@+id/start" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Start"> </Button> <Button android:id="@+id/start_once" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Start_once"> </Button> </LinearLayout>
三:在MianActivity中代码
package com.test; import android.app.Activity; import android.os.Bundle; import android.graphics.drawable.AnimationDrawable; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; public class MainA extends Activity { private AnimationDrawable draw = null; private Button start = null; private Button startOnce = null; private boolean isoneshot = true; public void onCreate(Bundle bundle) { super.onCreate(bundle); this.setContentView(R.layout.main); ImageView view = (ImageView)findViewById(R.id.imageview1); draw = (AnimationDrawable)view.getDrawable(); start = (Button)findViewById(R.id.start); start.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub startAnimation(); } }); startOnce = (Button)findViewById(R.id.start_once); startOnce.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub if(isoneshot) { startOnce.setText("startOnce"); } else { startOnce.setText("Play Repace"); } draw.setOneShot(isoneshot); isoneshot = !isoneshot; } }); } private void startAnimation() { if(draw.isRunning()) { draw.stop(); } else { draw.stop(); draw.start(); } } }
完成!
发表评论
-
Android 三大图片加载框架比较
2016-11-30 10:31 11041.哪三大图片加载框架? 1) Pi ... -
仿微信小视屏拍摄的进度条/自定义的progressBar的样式。
2016-08-20 00:25 1041今天有个需求,就是需要倒计时的进度条,样式参考微信小视屏拍摄 ... -
android 闹钟定时任务 AlarmManager
2016-06-02 13:41 1848直接上代码 package com.exampl ... -
android应用实现重启系统
2016-06-02 13:33 35351.在AndroidManifest.xml文件的manif ... -
android 每天定时提醒功能实现
2016-06-01 22:42 0android要实现定时的功 ... -
Java Calendar 类的时间操作
2016-06-01 21:02 673ava Calendar 类时间操作,这也许是创建日历和管理 ... -
android中fragment和activity之间相互通信
2014-11-13 16:25 1450在用到fragment的时候,老是会遇到一个问题,就是fra ... -
墨迹天气上下滑动viewpager
2014-11-04 17:15 778墨迹天气上下滑动viewpager -
Android杂谈--打开文件的Intent及使用
2014-10-25 13:03 653在写文件管理系统时会用到各种打开不同格式的文件的需求,由于A ... -
获取Android签名证书的sha1值
2014-08-23 23:14 680前言:今天开始研 ... -
java中Keytool的使用总结
2014-08-23 22:40 569J2SDK提供了keytool命令行工具,可以根据指定的参数 ... -
android获取versionName和versionCode
2014-07-08 18:02 746<TextView android:textSize= ... -
Android如何防止apk程序被反编译
2014-07-08 17:22 717作为Android应用开发者,不得不面对一个尴尬的局面,就是 ... -
在GridView中实现单选或多选功能
2014-06-26 13:08 859由于项目需要,要用到GridView实现多选功能,在网上搜 ... -
Android中Tween动画和Frame动画实例
2014-06-26 10:46 732Animation主要有两种动画模式:Tween动画和Fra ... -
android 禁用和开启四大组件的方法(setComponentEnabledSetting )
2014-06-19 15:26 0为什么要关闭组件? 在用到组件时,有时候我们可能暂时性的不使 ... -
android MD5校验码的生成与算法实现
2014-06-17 10:58 902在Java中,java.security.Mes ... -
android 自动检测版本升级
2014-06-15 14:10 389这里我用别的app代替了,简单省事,正常的话,你要对你的 ... -
layout左右平滑控制.
2014-04-30 09:41 630<?xml version="1.0&quo ... -
android让你的TabHost滑动起来
2014-04-22 22:13 826在Android应用中,一般TabActivity和若干个T ...
相关推荐
在这个特定的案例中,我们看到标题为“android逐帧动画”,描述提到有三张图片进行切换,每帧持续时间为50毫秒。这个例子展示了如何在Android应用中实现这种基本的动画效果。 首先,我们需要了解Android中的`...
在Android开发中,逐帧动画是一种常见的动画效果,它通过连续播放一系列静态图像来创造出动态效果,类似于传统的电影制作方式。本源码着重探讨如何在Android应用中实现逐帧动画。 首先,我们要了解Android中的两种...
在Android应用开发中,逐帧动画是一种常见的动画形式,它通过连续播放一系列静态图像来创造出动态效果,类似于传统的动画制作过程。"Android 逐帧动画源码.zip" 提供了一个项目实例,帮助开发者深入理解这一技术。这...
这个"Android逐帧动画源码.zip"文件包含了一个关于如何在Android应用中实现逐帧动画的示例项目,这对于开发者来说是宝贵的参考资料。 逐帧动画在Android中的实现主要依赖于`Animation`类家族,尤其是`Frame...
在Android应用开发中,逐帧动画是一种常见的动画形式,它通过连续播放一系列静态图像来创造出动态效果。这个"Android 逐帧动画源码.rar"压缩包包含了一个关于如何实现这种动画方式的源代码示例。下面,我们将深入...
在Android开发中,逐帧动画是一种常见的动画效果,它通过连续播放一系列静态图像来创造出动态效果,类似于传统的电影制作方式。本资源包“Android 逐帧动画源码.zip”提供了实现这种动画效果的源代码,适合对Android...
在Android平台上,逐帧动画是一种常见的视觉效果,用于创建连续的动态画面,类似于电影胶片。这个"Android 逐帧动画源码"是为毕业设计准备的开发示例,可以帮助学生深入理解Android应用的开发过程,并为撰写相关论文...
本资源"Android程序研发源码Android 逐帧动画源码.zip"提供了一个名为"AnimationDemo"的示例项目,旨在帮助开发者深入理解并实践Android中的逐帧动画技术。 首先,我们要明白逐帧动画的基本原理。逐帧动画是通过...
在Android平台上,逐帧动画是一种常见的动画实现方式,它通过连续播放一系列静态图像来创造出动态效果,类似于传统的电影制作原理。本项目“Android 逐帧动画源码.zip”提供了具体的实现示例,对于学生毕业设计、...
在Android中,逐帧动画可以通过`AnimationDrawable`类来实现。`AnimationDrawable`是一个可绘制对象,可以作为视图的背景,并且可以像动画一样顺序播放其包含的帧。以下将详细介绍如何创建和使用逐帧动画。 首先,...
首先,我们要理解Android中的逐帧动画。在Android中,帧动画(Frame Animation)是一种简单易用的动画形式,它通过连续播放一系列静态图像(帧)来创造出动画效果。这些帧通常保存为图片资源(如PNG或JPEG),然后在...
本篇文章将深入探讨Android逐帧动画的概念、实现方式以及相关的实践技巧。 逐帧动画的工作原理类似于传统的电影制作,通过连续播放多张图片来产生连续的动作。在Android中,这可以通过`AnimationDrawable`类来实现...