android帧动画的使用
来源:互联网 发布:啪啪啪软件下载 编辑:程序博客网 时间:2024/04/30 07:52
帧动画,顾名思义就是一帧一帧播放的动画,利用多张图片一张一张
进行播放。接下来我们通过在drawable文件夹中使用xml文件来定义帧动画。
代码如下:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/rocket_thrust1" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust2" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust3" android:duration="200" />
</animation-list>
其中android:oneshot="true"当为true时,代表动画播放一次,为false时,
动画无限循环播放。
然后在activity中使用imageview控件显示。代码如下:
ImageView iv = (ImageView) findViewById(R.id.iv);
iv.setBackgroundResource(R.drawable.frame);
AnimationDrawable ad = (AnimationDrawable) iv.getBackground();
ad.start();
进行播放。接下来我们通过在drawable文件夹中使用xml文件来定义帧动画。
代码如下:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/rocket_thrust1" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust2" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust3" android:duration="200" />
</animation-list>
其中android:oneshot="true"当为true时,代表动画播放一次,为false时,
动画无限循环播放。
然后在activity中使用imageview控件显示。代码如下:
ImageView iv = (ImageView) findViewById(R.id.iv);
iv.setBackgroundResource(R.drawable.frame);
AnimationDrawable ad = (AnimationDrawable) iv.getBackground();
ad.start();
0 0
- android帧动画的使用
- Android动画的使用
- Android动画的使用
- Android中的帧动画与补间动画的使用
- Android Frame(逐帧动画)的使用
- Android 帧动画(FrameAnimation)的使用
- Android 帧动画的使用场景
- Android动画-View动画的使用场景
- Android动画的使用(一):补间动画与逐帧动画
- Android 动画使用详解(一) 帧动画
- android popupwindow 动画的使用
- android动画的简单使用
- android 动画 amintorset 的使用
- Android使用动画的注意事项
- Android动画的基本使用
- Android动画的使用点滴
- android属性动画的使用
- Android动画TranslateAnimation的使用
- 在Ubuntu上使用Samba共享Linux内核源码
- Java学习笔记(Java中的数组/循环操作/Arrays类)
- android属性动画的使用
- flatMap与map的区别
- javascript RegExp对象
- android帧动画的使用
- hdu3388容斥还有二分
- android主题的切换
- 黄阶低级 - 《 Java 核心》- 3.6 字符串 - 修改0次
- Django零散知识小结
- android轮播图
- POJ-1125 Stockbroker Grapevine (floyd)
- react + redux大体思路(二)
- [Data Structure & Algorithm]Sort Algorithms