Android开发之Frame动画实现方法
2014-06-27 15:17
555 查看
1, 在该工程的res/anim/目录下创建一个XML动画文件,代码animation.xml 如所示
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/p01" android:duration="500"/>
<item android:drawable="@drawable/p02" android:duration="500"/>
.....
</animation-list>
2,显示界面布局文件添加 ImageView空件来显示动画
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@anim/animation"
android:id="@+id/ImageView01"></ImageView>
</LinearLayout>
3,在对应的Activity中实例花AnimationDrawable对象
private AnimationDrawable animationDrawable= imageView.getBackground();
animationDrawable.start();开始动画
animationDrawable.stop();结束动画
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/p01" android:duration="500"/>
<item android:drawable="@drawable/p02" android:duration="500"/>
.....
</animation-list>
2,显示界面布局文件添加 ImageView空件来显示动画
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@anim/animation"
android:id="@+id/ImageView01"></ImageView>
</LinearLayout>
3,在对应的Activity中实例花AnimationDrawable对象
private AnimationDrawable animationDrawable= imageView.getBackground();
animationDrawable.start();开始动画
animationDrawable.stop();结束动画
相关文章推荐
- Android开发之动画实现方法
- Android开发之背景动画简单实现方法
- Android游戏开发之使用AnimationDrable实现Frame动画(三十一)
- Android开发之Tween动画实现方法
- Android游戏开发之使用AnimationDrable实现Frame动画
- Android开发简单实现摇动动画的方法
- Android游戏开发之使用AnimationDrable实现Frame动画(三十一)
- 【Android游戏开发二十二】(图文详解)游戏中灵活实现动画播放!简述J2me的游戏类库与Android游戏开发!
- Android游戏开发之Tween动画的实现(三十二)
- Phome开发历程分享——自定义Activity切换动画实现(12.17更新方法)
- Android情侣短信软件(1)--Frame动画在悬浮窗口上的实现
- How:android开发中实现TextView垂直滚屏效果的方法
- Android开发中AsyncTask实现异步处理任务的方法
- Android开发中实现多点触摸的方法
- 【Android游戏开发二十二】(图文详解)游戏中灵活实现动画播放!简述J2me的游戏类库与Android游戏开发!
- 在Android开发中,定时器一般有以下3种实现方法:
- android 启动画面实现Frame动画
- Android应用程序入门 推箱子游戏开发(一) surfaceView 实现动画效果
- android 逐帧(Frame)动画的实现
- 22—(图文详解)游戏中灵活实现动画播放!简述J2me的游戏类库与Android游戏开发