android的一些动画集合以及layoutAnimation的一些用法


1  fade.xml

[html]  view plain copy
  1. <?xml version="1.0" encoding="utf-8"?>  
[html]  view plain copy
  1. <alpha xmlns:android="http://schemas.android.com/apk/res/android"  
  2.        android:interpolator="@android:anim/accelerate_interpolator"  
  3.        android:fromAlpha="0.0" android:toAlpha="1.0"  
  4.        android:duration="400" />  

2.hold.xml
[html]  view plain copy
  1. <?xml version="1.0" encoding="utf-8"?>  
  2.   
  3. <translate xmlns:android="http://schemas.android.com/apk/res/android"  
  4.        android:interpolator="@android:anim/accelerate_interpolator"  
  5.        android:fromXDelta="0" android:toXDelta="0"  
  6.        android:duration="@android:integer/config_longAnimTime" />  

3.hyperspace_in.xml
[html]  view plain copy
  1. <alpha  
  2.     xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:fromAlpha="0.0"  
  4.     android:toAlpha="1.0" android:duration="300"  
  5.     android:startOffset="1200" />  

4.hyperspace_out.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">  
  2.   
  3.     <scale   
  4.         android:interpolator="@android:anim/accelerate_decelerate_interpolator"  
  5.         android:fromXScale="1.0"   
  6.         android:toXScale="1.4"   
  7.         android:fromYScale="1.0"   
  8.         android:toYScale="0.6"   
  9.         android:pivotX="50%"  
  10.         android:pivotY="50%"  
  11.         android:fillAfter="false"  
  12.         android:duration="700" />  
  13.   
  14.   
  15.     <set   
  16.         android:interpolator="@android:anim/accelerate_interpolator"  
  17.                 android:startOffset="700">  
  18.           
  19.         <scale  
  20.             android:fromXScale="1.4"   
  21.             android:toXScale="0.0"  
  22.                 android:fromYScale="0.6"  
  23.             android:toYScale="0.0"   
  24.             android:pivotX="50%"   
  25.             android:pivotY="50%"   
  26.             android:duration="400" />  
  27.           
  28.         <rotate   
  29.             android:fromDegrees="0"   
  30.             android:toDegrees="-45"  
  31.             android:toYScale="0.0"   
  32.             android:pivotX="50%"   
  33.             android:pivotY="50%"  
  34.             android:duration="400" />  
  35.     </set>  
  36.   
  37. </set>  

5.layout_animation_row_left_slide.xml
[html]  view plain copy
  1. <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:delay="10%"  
  3.         android:animation="@anim/slide_left" />  
slide_left.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">  
  2.     <translate android:fromXDelta="100%p" android:toXDelta="0"  
  3.         android:duration="@android:integer/config_shortAnimTime" />  
  4. </set>  

6..layout_animation_row_right_slide.xml
[html]  view plain copy
  1. <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:delay="10%"  
  3.         android:animationOrder="reverse"  
  4.         android:animation="@anim/slide_right" />  
slide_right.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">  
  2.     <translate android:fromXDelta="-100%p" android:toXDelta="0"  
  3.             android:duration="@android:integer/config_shortAnimTime" />  
  4. </set>  

7.layout_animation_table.xml
[html]  view plain copy
  1. <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:delay="50%"  
  3.         android:animation="@anim/slide_top_to_bottom" />  
slide_top_to_bottom.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">  
  2.     <translate android:fromYDelta="-100%" android:toXDelta="0" android:duration="100" />  
  3.     <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="50" />  
  4. </set>  

8.layout_bottom_to_top_slide.xml
[html]  view plain copy
  1. <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:delay="30%"  
  3.         android:animationOrder="reverse"  
  4.         android:animation="@anim/slide_right" />  
slide_right.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">  
  2.     <translate android:fromXDelta="-100%p" android:toXDelta="0"  
  3.             android:duration="@android:integer/config_shortAnimTime" />  
  4. </set>  

9.layout_grid_fade.xml
[html]  view plain copy
  1. <gridLayoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:rowDelay="50%"  
  3.         android:directionPriority="column"  
  4.         android:animation="@anim/fade" />  
fade,xml见第一条

10 layout_grid_inverse_fade.xml
[html]  view plain copy
  1. <gridLayoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:columnDelay="0.5"  
  3.         android:directionPriority="row"  
  4.         android:direction="right_to_left|bottom_to_top"  
  5.         android:animation="@anim/fade" />  

11.layout_random_fade.xml
[html]  view plain copy
  1. <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:delay="0.5"  
  3.         android:animationOrder="random"  
  4.         android:animation="@anim/fade" />  

12 layout_wave_scale.xml
[html]  view plain copy
  1. <gridLayoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:rowDelay="75%"  
  3.         android:columnDelay="0%"  
  4.         android:directionPriority="none"  
  5.         android:animation="@anim/wave_scale" />  
wave_scale.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">  
  2.     <alpha  
  3.         android:fromAlpha="0.0"  
  4.         android:toAlpha="1.0"  
  5.         android:duration="100" />  
  6.     <scale  
  7.         android:fromXScale="0.5" android:toXScale="1.5"  
  8.         android:fromYScale="0.5" android:toYScale="1.5"  
  9.         android:pivotX="50%" android:pivotY="50%"  
  10.         android:duration="200" />  
  11.     <scale   
  12.         android:fromXScale="1.5" android:toXScale="1.0"  
  13.         android:fromYScale="1.5" android:toYScale="1.0"  
  14.         android:pivotX="50%" android:pivotY="50%"  
  15.         android:startOffset="200"  
  16.         android:duration="100" />  
  17. </set>  

13  push_up_in.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android">  
  2.     <translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="300"/>  
  3.     <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="300" />  
  4. </set>  

14push_up_out.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android">  
  2.     <translate android:fromYDelta="0" android:toYDelta="-100%p" android:duration="300"/>  
  3.     <alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="300" />  
  4. </set>  


15 zoom_enter.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:interpolator="@android:anim/decelerate_interpolator">  
  3.     <scale android:fromXScale="2.0" android:toXScale="1.0"  
  4.            android:fromYScale="2.0" android:toYScale="1.0"  
  5.            android:pivotX="50%p" android:pivotY="50%p"  
  6.            android:duration="@android:integer/config_mediumAnimTime" />  
  7. </set>  

16.zoom_exit.xml
[html]  view plain copy
  1. <set xmlns:android="http://schemas.android.com/apk/res/android"  
  2.         android:interpolator="@android:anim/decelerate_interpolator"  
  3.         android:zAdjustment="top">  
  4.     <scale android:fromXScale="1.0" android:toXScale=".5"  
  5.            android:fromYScale="1.0" android:toYScale=".5"  
  6.            android:pivotX="50%p" android:pivotY="50%p"  
  7.            android:duration="@android:integer/config_mediumAnimTime" />  
  8.     <alpha android:fromAlpha="1.0" android:toAlpha="0"  
  9.             android:duration="@android:integer/config_mediumAnimTime"/>  
  10. </set>  

17.cycle_7.xml
[html]  view plain copy
  1. <cycleInterpolator  
  2.     xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:cycles="7" />  

参考文章http://blog.csdn.net/simplehedy/article/details/7188308

1. LayoutAnimationController用于为一个Layout里面的控件或者是Viewgroup的控件设置动画效果。。

2.每一个控件都会有相同的动画效果

3.这些动画效果在不同的时间现实出来

4.LayoutAnimationController不仅可以在Layout里面实现也可以在代码中实现。。

怎么样在xml中使用LayoutAnimationController:

1在res/anim文件夹中创建一个新文件名为list-item-layout.xml文件

?xml version="1.0" encoding="utf-8"?>
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
 android:delay="2"
 android:animationOrder="normal" 
 android:animation="@anim/list_anim" />

2在布局文件当中添加如下配置

android:layoutAnimation=“@anim/list_item_layout”

在代码中使用LayoutAnimationController

1.创建一个Animation对象,可以通过装载xml文件 也可以通过构造函数构造对象

2.使用如下代码创建LayoutAnimationController

LayoutAnimationController  lac=new LayoutAnimationController(animation);

3.设置控件显示的顺序

lrc.setOrder(LayoutAnimationController.ORDER_NORMAL)

4.为ListView设置LayoutAnimationController属性

listview.setLayoutAnimation(lac);

Animation animation = (Animation)AnimationUtils.loadAnimation(MainActivity.this, R.anim.list_anim);
   LayoutAnimationController lac = new LayoutAnimationController(animation);
   lac.setOrder(LayoutAnimationController.ORDER_NORMAL);
   lac.setDelay(0.5f);
   listView.setLayoutAnimation(lac);

你可能感兴趣的:(android的一些动画集合以及layoutAnimation的一些用法)