六、转场动画(Activity切换动画)

在StartActivity后即调用overridePendingTransition(int enterAnim, int exitAnim)

//in

<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

<translate

android:fromXDelta="100%p"
android:toXDelta="0"
android:duration="500"/>

</set>
//out

<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android">

<translate

android:fromXDelta="0"
android:toXDelta="-100%p"
android:duration="500"/>

</set>

七、逐帧动画(Frame By Frame

Frame by frame 指将一幅幅图片按序播放,效果像gif动画:

第一步:将用到的图片资源加到工程。

第二步:在xml里定义动画。

<?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/rkof" android:duration="200" />

<item android:drawable="@drawable/hkof" android:duration="200" />

<item android:drawable="@drawable/gkof" android:duration="200" />

<item android:drawable="@drawable/fkof" android:duration="200" />

<item android:drawable="@drawable/ekof" android:duration="200" />

<item android:drawable="@drawable/dkof" android:duration="200" />

<item android:drawable="@drawable/ckof" android:duration="200" />

<item android:drawable="@drawable/bkof" android:duration="200" />

<item android:drawable="@drawable/akof" android:duration="200" />

</animation-list>

<!-- android:oneshot属性为true,它将会在最后一帧停下来,如果设置

为false这个动画将循环播放 -->

第三步:定义AnimationDrawable对像

ImageView myImage = (ImageView) findViewById(R.id.rocket_image);

myImage.setBackgroundResource(R.anim.myframeanimation);

AnimationDrawable frameAnimation=(AnimationDrawable) myImage.getBackground();

第四步:播放

frameAnimation.start()

八、ApiDemo中的动画研究

1. 平滑:

Graphics/AnimateDrawables

2. 淡入淡出 :

App/Activity/Animation

3. 放大缩小 :

App/Activity/Animation && Graphics/ScaleToFit

4. 翻转 :

Views/Animation/3D Transition && Graphics/PolyToPoly

5. 透明:

App/Activity/Translucent

6. 模糊:

App/Activity/Translucent Blur

7. Overlay:

Graphics/SurfaceView OverLay

8. 反弹效果:

Views/Animation/Shake

9. 文字效果:

Views/Animation/Push && Views/Animation/Interpolators

更多相关文章

  1. android集成百度地图SDK 自定义keystore无法编译 Keystore was t
  2. 用ViewFlipper实现各种切换动画
  3. Android编译系统
  4. android 动画总结
  5. 介绍一个Android开源项目:GifView——Android显示GIF动画
  6. Android中自定义View仿京东秒杀倒计时
  7. Android(安卓)IOS平台AE动画库
  8. Android(安卓)自定义View引用xml布局
  9. Android(安卓)视频播放

随机推荐

  1. CMD命令操作MySql数据库的方法详解
  2. MySQL查询重复数据(删除重复数据保留id最
  3. Mysql5.6修改root密码教程
  4. MySql闪退和服务无法启动的解决方法
  5. Mysql5.7修改root密码教程
  6. mysql的集群模式 galera-cluster部署详解
  7. getdata table表格数据join mysql方法
  8. MySQL开启Slow慢查询的方法示例
  9. 使用SQL语句统计数据时sum和count函数中
  10. Mysql Update批量更新的几种方式