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

1  fade.xml

<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
       android:interpolator="@android:anim/accelerate_interpolator"
       android:fromAlpha="0.0" android:toAlpha="1.0"
       android:duration="400" />

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

<translate xmlns:android="http://schemas.android.com/apk/res/android"
       android:interpolator="@android:anim/accelerate_interpolator"
       android:fromXDelta="0" android:toXDelta="0"
       android:duration="@android:integer/config_longAnimTime" />

3.hyperspace_in.xml
<alpha
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:fromAlpha="0.0"
	android:toAlpha="1.0" android:duration="300"
	android:startOffset="1200" />

4.hyperspace_out.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">

	<scale 
		android:interpolator="@android:anim/accelerate_decelerate_interpolator"
		android:fromXScale="1.0" 
		android:toXScale="1.4" 
		android:fromYScale="1.0" 
		android:toYScale="0.6" 
		android:pivotX="50%"
		android:pivotY="50%"
		android:fillAfter="false"
		android:duration="700" />


	<set 
		android:interpolator="@android:anim/accelerate_interpolator"
                android:startOffset="700">
		
		<scale
			android:fromXScale="1.4" 
			android:toXScale="0.0"
		        android:fromYScale="0.6"
	 		android:toYScale="0.0" 
	 		android:pivotX="50%" 
	 		android:pivotY="50%" 
	 		android:duration="400" />
 		
		<rotate 
			android:fromDegrees="0" 
			android:toDegrees="-45"
	 		android:toYScale="0.0" 
	 		android:pivotX="50%" 
	 		android:pivotY="50%"
	 		android:duration="400" />
	</set>

</set>

5.layout_animation_row_left_slide.xml
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
        android:delay="10%"
        android:animation="@anim/slide_left" />
slide_left.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
    <translate android:fromXDelta="100%p" android:toXDelta="0"
        android:duration="@android:integer/config_shortAnimTime" />
</set>

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

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

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

9.layout_grid_fade.xml
<gridLayoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
        android:rowDelay="50%"
        android:directionPriority="column"
        android:animation="@anim/fade" />
fade,xml见第一条

10 layout_grid_inverse_fade.xml
<gridLayoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
        android:columnDelay="0.5"
        android:directionPriority="row"
        android:direction="right_to_left|bottom_to_top"
        android:animation="@anim/fade" />

11.layout_random_fade.xml
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
        android:delay="0.5"
        android:animationOrder="random"
        android:animation="@anim/fade" />

12 layout_wave_scale.xml
<gridLayoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
        android:rowDelay="75%"
        android:columnDelay="0%"
        android:directionPriority="none"
        android:animation="@anim/wave_scale" />
wave_scale.xml
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
    <alpha
        android:fromAlpha="0.0"
        android:toAlpha="1.0"
        android:duration="100" />
    <scale
        android:fromXScale="0.5" android:toXScale="1.5"
        android:fromYScale="0.5" android:toYScale="1.5"
        android:pivotX="50%" android:pivotY="50%"
        android:duration="200" />
    <scale 
        android:fromXScale="1.5" android:toXScale="1.0"
        android:fromYScale="1.5" android:toYScale="1.0"
        android:pivotX="50%" android:pivotY="50%"
        android:startOffset="200"
        android:duration="100" />
</set>

13  push_up_in.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
	<translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="300"/>
	<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="300" />
</set>

14push_up_out.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
	<translate android:fromYDelta="0" android:toYDelta="-100%p" android:duration="300"/>
	<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="300" />
</set>


15 zoom_enter.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:anim/decelerate_interpolator">
    <scale android:fromXScale="2.0" android:toXScale="1.0"
           android:fromYScale="2.0" android:toYScale="1.0"
           android:pivotX="50%p" android:pivotY="50%p"
           android:duration="@android:integer/config_mediumAnimTime" />
</set>

16.zoom_exit.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
        android:interpolator="@android:anim/decelerate_interpolator"
        android:zAdjustment="top">
    <scale android:fromXScale="1.0" android:toXScale=".5"
           android:fromYScale="1.0" android:toYScale=".5"
           android:pivotX="50%p" android:pivotY="50%p"
           android:duration="@android:integer/config_mediumAnimTime" />
    <alpha android:fromAlpha="1.0" android:toAlpha="0"
            android:duration="@android:integer/config_mediumAnimTime"/>
</set>

17.cycle_7.xml
<cycleInterpolator
    xmlns:android="http://schemas.android.com/apk/res/android"
    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);










评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值