读书人

Android开发-图形图像与卡通(五)-详

发布时间: 2013-01-28 11:49:56 作者: rapoo

Android开发--图形图像与动画(五)--详解LayoutAnimationController

首先需要先介绍下LayoutAnimationController:

* 1.LayoutAnimationController用于为一个layout里面的控件,或者是一个ViewGroup
* 里面的控件设置动画效果(即整个布局)
* 2.每一个控件都有相同的动画效果
* 3.这些控件的动画效果在不同的实现显示出来
* 4.LayoutAnimationController可以在xml文件当中设置,也可以在代码中进行设置

本文就针对两种实现LayoutAnimationController的方法分别进行介绍:

一,在XML文件中实现

步骤如下图所示:

Android开发-图形图像与卡通(五)-详解LayoutAnimationController

下面以一个实例来说明实现的方法:

实现的例子是点击“测试”按钮,有动画形式的view展现出来,截图如下:

Android开发-图形图像与卡通(五)-详解LayoutAnimationController

具体的实现过程如下:

需要两个动画xml文件:

1.list_item_layout


在本例中用到的代码如下:

Animation animation=AnimationUtils.loadAnimation(LayoutAnimation_Activity.this, R.anim.list_item_alpha);LayoutAnimationController laController=new LayoutAnimationController(animation);laController.setOrder(LayoutAnimationController.ORDER_NORMAL);listView.setLayoutAnimation(laController);


读书人网 >图形图像

热点推荐